简体   繁体   中英

Magento open_basedir restriction in effect. File(/tmp) is not within the allowed path(s):

i'm having some trouble about uploading image on Magento CMS in all page/product. I've enabled erro log and i'll report it to check. NOTE: Only for post now, I have sobstitute my address domain with "mydomain.com". Only for sample.

[Sun Feb 02 15:02:14 2014] [error] [client 146.105.28.41] client denied by server configuration: /var/www/vhosts/mydomain.com/httpdocs/app/etc/local.xml

[Sun Feb 02 15:02:18 2014] [error] [client 146.105.28.41] client denied by server configuration: /var/www/vhosts/mydomain.com/httpdocs/app/etc/local.xml

[Sun Feb 02 15:02:36 2014] [warn] [client 151.67.115.48] mod_fcgid: stderr: PHP Warning: Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/vhosts/mydomain.com:/usr/share/php:/usr/share/pear) in Unknown on line 0

[Sun Feb 02 15:02:36 2014] [warn] [client 151.67.115.48] mod_fcgid: stderr: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0

You will need to add an open_basedir exemption for /tmp, turn open_basedir off entirely, or change the php temp directory to something within /var/www/vhosts/mydomain.com.

  1. I recommend the first.
  2. I've read reports (With no explanation) that you should do the second.
  3. You can do the 3rd from within the Apache config:

     <Directory /var/www/vhosts/mydomain.com/> php_admin_value upload_tmp_dir /var/www/vhosts/mydomain.com/temp </Directory> 

Answers here did not work for me:

  • an open_basedir exception for /tmp is usually not the best solution, because it means that users have access to other users' tmp files (possible security issue)
  • open_basedir is usually active for a reason, switching it off entirely might be a security issue
  • the problem still occured after modifying the upload_tmp_dir

For me, the magento installation worked after I set the php.ini value sys_temp_dir to a value within the open_basedir directory.

To be safe, I checked all tmp paths displayed in phpinfo() and changed them like this:

<Directory /var/www/myvirtualhost> php_admin_value upload_tmp_dir /var/www/myvirtualhost/tmp php_admin_value soap.wsdl_cache_dir /var/www/myvirtualhost/tmp php_admin_value opcache.lockfile_path /var/www/myvirtualhost/tmp php_admin_value sys_temp_dir /var/www/myvirtualhost/tmp </Directory>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM