Support » Fixing WordPress » [2.5] Plugin update and temporary directories

  • I’ve tried to use the automatic plugin update script, but ran into some trouble which might be worth looking into.

    I’m using a setup where the standard system temp dir ( for some reasons ) isn’t writable, so you get error like these:

    Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File(/var/tmp/) is not within the allowed path(s): (/home/bla:/home/bla/public_html/include) in /home/bla/public_html/wp25/wp-admin/includes/file.php on line 321

    For that I’ve set the WP_TEMP_DIR constant to a writable map. This takes me one step further to where the download is tried to be saved. Due to the $wp_filesystem _ $method this one is handled by the FTP class in wp-admin/includes. This one uses a different constant name FTP_BASE ( is that correct? ). Otherwise this step won’t work.

    it both generates the error: ‘Unable to locate WordPress directory.’, but the error is generated firstly on file.php and in the second case on class-wp-filesystem-ftpext.php

    The problem is when both are set the whole function (download goes correct – I checked ) stop when for some reason it cannot extract the zip file ( unable to copy zip-file ).

    I cannot see why not, the zip-file is there. Both constants point to the same map and yet the function keeps on looking for /var/tmp as the map to go, while it uses get_tmp_dir() to get a temp location in any way. Both are outputting that correctly.

    This perhaps might be something you want to document as well as probably more people will have problems with it 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • I have same problem whit my WordPress blog (version is 2.5.1):

    Warning: tempnam() [function.tempnam]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/e1:/usr/lib/php5:/usr/share/php5:/usr/share/php:/var/www/htdocs:/var/www/localhost/htdocs) in /home/e1/public/www/wp-admin/includes/file.php on line 322

    when I write to the wp-config.php file:

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

    WP generate error:

    Warning: ftp_pwd() [function.ftp-pwd]: Directory successfully changed. in /home/e1/public/www/wp-admin/includes/class-wp-filesystem-ftpext.php on line 188

    Warning: ftp_pwd() [function.ftp-pwd]: Here comes the directory listing. in /home/e1/public/www/wp-admin/includes/class-wp-filesystem-ftpext.php on line 188

    The WP directory is: /home/e1/public/www
    The temp dirctory is: /home/e1/tmp

    After all kinds of testing I found out, that the updater doesn’t work with “paranoid” firewall settigs combined with not passive ftp mode!

    The solution is to allow passive ftp mode on the server.

    I am also facing a similar issue:
    After some ‘tmp dir not writable’ errors, I have pointed WP_TEMP_DIR to the correct directory, but now another error is remaining:

    Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary file. Check permissions in temporary files directory. in /is/htdocs/wp1008945_0Q245FN7MJ/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php on line 192

    Unable to locate WordPress Plugin directory.

    Installation Failed

    Any idea?

    [edit] My hoster is



    i was also affected by the safe mode restrictions

    fixed it by the following:

    added to /config.php

    define('WP_TEMP_DIR', '/my/writable/dir');

    removed trailingslashit() from /wp-admin/includes/file.php
    line 75
    now looks like this:

    function get_temp_dir() {
    	if ( defined('WP_TEMP_DIR') )
    		return $WP_TEMP_DIR;

    maybe code needs to be fixed there in the next update

    Add this in your wp-config.php

    define(‘WP_TEMP_DIR’, ini_get(‘upload_tmp_dir’));

    in php.ini add the path to allowed(with permissions) temp dir

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[2.5] Plugin update and temporary directories’ is closed to new replies.