Support » Fixing WordPress » Fix for open_basedir not in allowed path(s) message

  • Resolved Steven

    (@stgoos)


    When you are trying to auto update plugins via the build-in updater you might get error messages like:

    Warning: file_exists() [function.file-exists]: open_basedir restriction
    in effect. File(/var/tmp//1220989448) is not within the allowed
    path(s): (/home/usr123/:/tmp:/usr/local/lib/php/) in /usr/home/usr123
    /../wp-includes/functions.php on line 1960
    
    Warning: touch() [function.touch]: open_basedir restriction in effect.
    File(/var/tmp/1220989448) is not within the allowed path(s): (/home
    /usr123/:/tmp:/usr/local/lib/php/) in /usr/home/usr123/../wp-admin
    /includes/file.php on line 122
    
    Warning: fileowner() [function.fileowner]: open_basedir restriction
    in effect. File(/var/tmp/1220989448) is not within the allowed
    path(s): (/home/usr123/:/tmp:/usr/local/lib/php/) in /usr/home/usr123
    /../wp-admin/includes/file.php on line 487
    
    Warning: unlink() [function.unlink]: open_basedir restriction in effect.
    File(/var/tmp/1220989448) is not within the allowed path(s): (/home
    /usr123/:/tmp:/usr/local/lib/php/) in /usr/home/usr123/../wp-admin
    /includes/file.php on line 489

    Today, I got it fix by adding a single line to the wp-config.php file 🙂

    Just have a look at the following section: allowed path(s): (/home/usr123/:/tmp:/usr/local/lib/php/)

    In it, there is /tmp which is obviously way different then the via the get_temp_dir function (/wp-admin/includes/file.php:97) collected /var/tmp !!

    So in order to fix this just add the following string to the wp-config.php:

    define('WP_TEMP_DIR','/tmp');

    The solution couldn’t be easier found than by looking at the get_temp_dir function itself and a quick search through the whole WP source code 😛

    function get_temp_dir() {
      if ( defined('WP_TEMP_DIR') )
        return trailingslashit(WP_TEMP_DIR);
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fix for open_basedir not in allowed path(s) message’ is closed to new replies.