WordPress.org

Ready to get started?Download WordPress

Forums

BulletProof Security
[resolved] problem updating to 48.9 (12 posts)

  1. pbm160
    Member
    Posted 9 months ago #

    When I try to update from the dashboard the update fails. I never had any problem before. This is the warnings:

    Warning: touch() [function.touch]: Unable to create file /xxx/xxx/public_html/wp-content/uploads/bulletproof-security.tmp because No such file or directory in /xxx/xxx/public_html/wp-admin/includes/file.php on line 179

    Warning: unlink(/xxx/xxx/public_html/wp-content/uploads/bulletproof-security.tmp) [function.unlink]: No such file or directory in /xxx/xxx/public_html/wp-admin/includes/file.php on line 503

    An error occurred while updating BulletProof Security: Download failed. Destination directory for file streaming does not exist or is not writable.

    http://wordpress.org/extend/plugins/bulletproof-security/

  2. AITpro
    Member
    Plugin Author

    Posted 9 months ago #

    Here is the function at code line 179 in the /wp-admin/includes/file.php file. My guesses are these:
    either your tmp folder is maxed out, your disk space on your Server is maxed out, or something has changed with the path to your temp folder - ie in your php.ini file or open_basedir has been enabled on your Server or in your php.ini file and the /tmp directory path is not valid or does not exist or has been restricted incorrectly/inappropriately. This is something you should contact your Host about.

    http://wordpress.org/support/topic/plugins-not-updating-since-wp-35-installed?replies=20

    /**
     * Returns a filename of a Temporary unique file.
     * Please note that the calling function must unlink() this itself.
     *
     * The filename is based off the passed parameter or defaults to the current unix timestamp,
     * while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory.
     *
     * @since 2.6.0
     *
     * @param string $filename (optional) Filename to base the Unique file off
     * @param string $dir (optional) Directory to store the file in
     * @return string a writable filename
     */
    function wp_tempnam($filename = '', $dir = '') {
    	if ( empty($dir) )
    		$dir = get_temp_dir();
    	$filename = basename($filename);
    	if ( empty($filename) )
    		$filename = time();
    
    	$filename = preg_replace('|\..*$|', '.tmp', $filename);
    	$filename = $dir . wp_unique_filename($dir, $filename);
    	touch($filename);
    	return $filename;
    }
  3. AITpro
    Member
    Plugin Author

    Posted 9 months ago #

    hmm did you rename your /uploads folder to something other than /uploads or change any of the standard WordPress folder structures. ie changing the wp-content folder name to something else? Based on what this check looks at the link I posted above will first look for this Constant below in your wp-config.php file, then do a Windows temp dir check, then a stand PHP/Apache /tmp dir check and the final check is the root of /wp-content. And to tell you truth I wonder if your /uploads folder should be used as a /tmp folder - seems kind of off to me, but not sure about that. Seems to me it should be /xxxx/tmp.

    define('WP_TEMP_DIR','/path/to/a/temp/dir');

    function get_temp_dir() {
    	static $temp;
    	if ( defined('WP_TEMP_DIR') )
    		return trailingslashit(WP_TEMP_DIR);
    
    	if ( $temp )
    		return trailingslashit( rtrim( $temp, '\\' ) );
    
    	if ( function_exists('sys_get_temp_dir') ) {
    		$temp = sys_get_temp_dir();
    		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
    			return trailingslashit( rtrim( $temp, '\\' ) );
    	}
    
    	$temp = ini_get('upload_tmp_dir');
    	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
    		return trailingslashit( rtrim( $temp, '\\' ) );
    
    	$temp = WP_CONTENT_DIR . '/';
    	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
    		return $temp;
    
    	$temp = '/tmp/';
    	return $temp;
    }
  4. pbm160
    Member
    Posted 9 months ago #

    I haven't changed anything myself. I think the problem must be with my host. Yesterday they migrated to a new hardware platform (my site was down for more than 10 hours). I don't know if the path for the temp folder has changed.
    Also my error_log a few days ago was showing errors that I couldn't understand and my host said that they corrected the issue and submitted php.ini for my domain.
    Since the move yesterday I can see the php.ini in my root directory (before I couldn't) and the errors related to what was showing in my error_log are written in the php.ini. Don't know if this is normal or actually what the php.ini does or where it should be as I'm not 'technical' :-)

    I guest the best will be to contact my host. They might be able to rectify the problem.

  5. AITpro
    Member
    Plugin Author

    Posted 9 months ago #

    Most likely the issue/problem is going to be with either the upload_tmp_dir or the open_basedir directives in the php.ini file in your website root folder.

    Source: http://www.php.net/manual/en/ini.core.php#ini.upload-tmp-dir

    upload_tmp_dir string
    The temporary directory used for storing files when doing file upload. Must be writable by whatever user PHP is running as. If not specified PHP will use the system's default.

    If the directory specified here is not writable, PHP falls back to the system default temporary directory. If open_basedir is on, then the system default directory must be allowed for an upload to succeed.

    Download the php.ini file in your root directory. Open it and look for/search for both of these directives and post what you find back here.

  6. AITpro
    Member
    Plugin Author

    Posted 9 months ago #

    Some example scenarios:

    1. open_basedir is not being used at all (hopefully because it is junk) and upload_tmp_dir is either not in your php.ini file or the path/value is incorrect.

    /tmp is the standard value for this directive. You would add this directive with this value in your php.ini file if it does not already exist. If it does exist make sure that the path/value is /tmp.
    upload_tmp_dir = /tmp

    2. open_basedir is being used in your php.ini file, but the /tmp directory is not included in the path/value.

    Wrong: open_basedir = /home/users/you/public_html
    Correct: open_basedir = /home/users/you/public_html:/tmp

    Note: If you do not see open_basedir in your php.ini file this is a good thing - DO NOT add it - it is junk.

  7. pbm160
    Member
    Posted 9 months ago #

    I had a look in the php.ini.
    There is no upload_tmp_dir or open_basedir. So if I understand you well I should add to the php.ini:

    upload_tmp_dir = /tmp

    Do I need to do/add anything else?

  8. AITpro
    Member
    Plugin Author

    Posted 9 months ago #

    Yep, you got it - ONLY add upload_tmp_dir = /tmp and DO NOT add the open_basedir directive - the only thing open_basedir does well is it causes problems on your website that will make you crazy. It is useless as a hacker deterrent or protection since even noob hackers can beat open_basedir. ;)

  9. AITpro
    Member
    Plugin Author

    Posted 9 months ago #

    Did this work? If so, please resolve this Thread. If it did not work then post a status update. Thanks.

  10. pbm160
    Member
    Posted 9 months ago #

    Sorry I was away for a few days. No it didn't work. I get the same error/warning when I try to update from the dashboard.

  11. AITpro
    Member
    Plugin Author

    Posted 9 months ago #

    Oh well it was worth a shot. Guess you will have to contact your Host and find out what they have changed. Nothing changed with BPS that could be causing this problem so since your Host made major changes to your Hosting account/Server then something must need to be adjusted on their end.

  12. pbm160
    Member
    Posted 9 months ago #

    Thanks AITpro for your time and help. The problem wasn't with BPS.

    The matter has been resolved now. The problem came from my host who changed the name of my directory during the migration (without telling me!). I updated the path in wp-config.php and it's working fine now.

Reply

You must log in to post.

About this Plugin

About this Topic