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

后端 未结 13 2217
醉话见心
醉话见心 2020-11-22 01:45

I\'m getting this error on an avatar upload on my site. I\'ve never gotten it before and nothing was changed recently for me to begin getting this error...

         


        
相关标签:
13条回答
  • 2020-11-22 02:37

    The path you're refering to is incorect, and not withing the directoryRoot of your workspace. Try building an absolute path the the file you want to access, where you are now probably using a relative path...

    0 讨论(0)
  • 2020-11-22 02:38

    Modify the open_basedir settings in your PHP configuration (See Runtime Configuration).

    The open_basedir setting is primarily used to prevent PHP scripts for a particular user from accessing files in another user's account. So usually, any files in your own account should be readable by your own scripts.

    Example settings via .htaccess if PHP runs as Apache module on a Linux system:

    <DirectoryMatch "/home/sites/site81/">
        php_admin_value open_basedir "/home/sites/site81/:/tmp/:/"
    </DirectoryMatch>
    
    0 讨论(0)
  • 2020-11-22 02:41

    For me the problem was bad/missing config values for the Plesk server running the whole thing. I just followed the directions here: http://davidseah.com/blog/2007/04/separate-php-error-logs-for-multiple-domains-with-plesk/

    You can configure PHP to have a separate error log file for each VirtualHost definition. The trick is knowing exactly how to set it up, because you can’t touch the configuration directly without breaking Plesk. Every domain name on your (dv) has its own directory in /var/www/vhosts. A typical directory has the following top level directories:

    cgi-bin/
    conf/
    error_docs/
    httpdocs/
    httpsdocs/
    ...and so on
    

    You’ll want to create a vhost.conf file in the domain directory’s conf/ folder with the following lines:

    php_value error_log /path/to/error_log
    php_flag display_errors off
    php_value error_reporting 6143
    php_flag log_errors on
    

    Change the first value to match your actual installation (I used /tmp/phperrors.log). After you’re done editing the vhost.conf file, test the configuration from the console with:

    apachectl configtest
    …or if you don’t have apachectl (as Plesk 8.6 doesn’t seem to)…
    
    /etc/init.d/httpd configtest
    

    And finally tell Plesk that you’ve made this change.

    /usr/local/psa/admin/bin/websrvmng -a
    
    0 讨论(0)
  • 2020-11-22 02:46

    I had this problem @ one of my wordpress sites after updating and/or moving :)

    Check in database table 'wp_options' the 'upload_path' and edit it properly...

    0 讨论(0)
  • 2020-11-22 02:48

    To resolve this error, you must edit the file httpd.conf. Way before it can be seen in phpinfo in apache2handler section directive Server Root. For example, in my case this way - / etc / httpd / httpd.conf. Open the file httpd.conf, find the mention of the parameter open_basedir. And set it to none. (php_admin_value open_basedir none)

    0 讨论(0)
  • 2020-11-22 02:48

    If you're running this with php file.php. You need to edit php.ini Find this file:

    : locate php.ini
    /etc/php/php.ini
    

    And append file's path to open_basedir property:

    open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/:/run/media/andrew/ext4/protected

    0 讨论(0)
提交回复
热议问题