PHP文件上传时关于open_basedir的报错解决

Standard

PHP Upload files to the virtual host errors:
Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/tmp/phpEIjcGh) is not within the allowed path(s): (/usr/local/apache/htdocs/) in /usr/local/apache/htdocs/xxxsite/upload.htm on line 21

Because web users to operate without permission belong to the “root” directory /tmp/

Solution:
Apache virtual server configuration file to add add the follow info:
<Directory “/usr/local/apache/htdocs/xxxsite”>
php_admin_value open_basedir /usr/local/apache/htdocs/xxxsite/:/tmp/
</Directory>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.