WordPress.org

Forums

[resolved] Fix for open_basedir not in allowed path(s) message (5 posts)

  1. Steven
    Member
    Posted 6 years ago #

    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 :P

    function get_temp_dir() {
      if ( defined('WP_TEMP_DIR') )
        return trailingslashit(WP_TEMP_DIR);
  2. cubells
    Member
    Posted 6 years ago #

    Hi stgoos:

    I have a similar message: File(/) is not within the allowed path(s): (/home/marina/:/tmp/)

    and your instructions do not work...

    Can you help me?

    is it a problem of my webhosting? Is it a problem of the wordpress??

    Thanks a lot!

  3. cubells
    Member
    Posted 6 years ago #

    I've got it.

    I had an incorrect directory.

  4. lausianne
    Member
    Posted 6 years ago #

    Hi Cubells,

    would you mind posting what exactly was wrong with your directory. The fix doesn't work for me either.

    Thanks!

  5. lausianne
    Member
    Posted 6 years ago #

    I found a solution for me in another forum message by marX. The line that I needed to add to wp-config.php was

    define('WP_TEMP_DIR', ini_get('upload_tmp_dir'));

    (found here: http://forum.wordpress-deutschland.org/installation/44413-automatische-updates-fehler.html#post214689)

Topic Closed

This topic has been closed to new replies.

About this Topic