实际上open_basedir的限制 [英] open_basedir restriction in effect
问题描述
我一直在使用我的服务器上的文件上传脚本遇到了麻烦 - 得出结论,这是因为PHP正在对Apache模块运行,因此PHP重新配置为运行的FastCGI
I have been having trouble using a file upload script on my server - came to the conclusion that this was because PHP was being run on Apache Module so reconfigured PHP to run as FastCGI.
不幸的是现在,当我尝试通过uploadify我得到的错误上传文件
Unfortunately now when I try to upload a file via uploadify I get the error
警告:有效move_uploaded_file()以[function.move上传文件] open_base_dir限制。文件(/var/www/vhosts/domain.com/uploads/filename.txt)是不是在允许的路径(S)内(在/ var / WWW /虚拟主机/ domain.com / httpdocs资料:/ tmp)中的... ..
Warning: move_uploaded_file()[function.move-uploaded-file] open_base_dir restrictions in effect. File(/var/www/vhosts/domain.com/uploads/filename.txt) is not within the allowed path(s):(/var/www/vhosts/domain.com/httpdocs:/tmp) in .....
然后,它指的是我排队我的剧本32个内容是:
It then refers me to line 32 of my script which reads:
move_uploaded_file($tempFile,$targetFile);
$ TEMPFILE如下:
$tempFile is as follows:
$tempFile = str_replace(" ","",$_FILES['Filedata']['tmp_name']);
我试图改变我的vhost.conf文件在许多方面位没有成功 - 它目前为为
I have tried altering my vhost.conf file in numerous ways bit without success - it currently stands as
<Directory /var/www/vhosts/domain.com/httpdocs>
<IfModule sapi_apache2.c>
php_admin_flag engine off
php_admin_flag safe_mode on
php_admin_value open_basedir none
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir none
</IfModule>
</Directory>
我似乎在圈子一轮去 - 它似乎是tmp目录没有被发现。
I seem to be going round in circles - it seems that the tmp directory is not being found
推荐答案
如果这是你的服务器和你其实可以乱用配置的周围,你可以关闭的open_basedir
中你的php.ini,重新载入PHP和尝试,如果它的工作原理。 safe_mode设置
应该是默认的,因为这会导致选项只问题PHP关闭。
If it's your server and you can actually mess around with configuration, you can turn off the open_basedir
in your php.ini, reload PHP and try if it works. safe_mode
should be turned off in PHP by default as this option causes only problems.
或者你可以尝试以下操作:
Or you can try following:
<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs/:/tmp/:/var/www/vhosts/domain.com/uploads/"
</Directory>
同样可以申请在php.ini如果您决定设置的配置那里。
Same can apply for the php.ini if you decide to set the config there.
这篇关于实际上open_basedir的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!