• Hello! Without any changes to my plugins, themes, or php (everything had been updated by the creators at least a week prior), WP suddenly would not let me upload images.

    I received the classic error “missing temporary folder” when trying to upload images. I read a lot of literature on the error that all provided the same solution: https://hostpapasupport.com/how-to-fix-missing-temporary-folder-error-in-wordpress/

    I followed these steps to a tee – first adding the appropriate line of code to wp-config.php, then adding a /temp folder. It only exacerbated the issues and prevented me from logging into WP, so I deprecated the code to the previous instance, and thus started receiving the original error again. I checked with HostGator, and I’m fine on space.

    However, I’m still receiving the “missing temporary folder” error, and the following errors appear when I go to the ‘posts’ section of WP:

    Warning: session_start(): open(/tmp/sess_e502b91bbafd2f5d2eb1d649ec5384ce, O_RDWR) failed: Permission denied (13) in /home4/wahicm0aeqla/public_html/wp-content/plugins/custom-sidebars/inc/external/wpmu-lib/inc/class-thelib.php on line 145

    Warning: session_start(): Failed to read session data: files (path: /tmp) in /home4/wahicm0aeqla/public_html/wp-content/plugins/custom-sidebars/inc/external/wpmu-lib/inc/class-thelib.php on line 145

    Warning: Cannot modify header information – headers already sent by (output started at /home4/wahicm0aeqla/public_html/wp-content/plugins/custom-sidebars/inc/external/wpmu-lib/inc/class-thelib.php:145) in /home4/wahicm0aeqla/public_html/wp-admin/includes/misc.php on line 1196

    All of the permissions are set to 755 on the relevant directory level and 644 on the file level. It appears that the above errors are related to the custom-sidebars plugin, but I wouldn’t expect this to impact my ability to upload images.

    What other recourse is there? Thanks in advance for your help.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi, the error comes from a plugin.
    write in the plugin support area. https://wordpress.org/support/plugin/custom-sidebars

    Thread Starter soccerandtacos

    (@soccerandtacos)

    Hi @autotutorial – I had already posted in the plugin support area.

    However, as I said, the ‘missing temporary folder’ error would appear to be unrelated to the issues with the plugin. Custom-Sidebars isn’t a tool that uses images, so why would an error with the plugin prevent me from uploading images?

    instead you’re wrong the error comes from the plugin not from wordpress core.
    It may be that other plugins or themes conflict with plugin Custom Sidebars.
    Backup your files and your database, then try disabling the plugin Custom Sidebars.
    if everything works and you don’t find errors it means that it is the plugin that creates the defect.

    Note* From the error list you must first resolve the first error the file is not accessible or non-existent (all other errors are derived from the first error).

    define('WP_TEMP_DIR','/home/username/www/wp-content/temp');
    or
    define('WP_TEMP_DIR',dirname(__FILE__).'/wp-content/temp');

    However this code normally overrides the default folder in one you defined.
    because it doesn’t work I don’t know.
    https://developer.wordpress.org/reference/functions/get_temp_dir/

    $temp = WP_CONTENT_DIR . '/';
        if ( is_dir( $temp ) && wp_is_writable( $temp ) ) {
            return $temp;
        }
     
        return '/tmp/';

    https://github.com/WordPress/WordPress/blob/master/wp-includes/default-constants.php#L71
    WP_CONTENT_DIR I read this code will have the value of ABSPATH (root wordpress) wp-content for $temp = ABSPATH.’wp-content’.’/’ if it is a directory and writable return this otherwise /tmp/

    What permissions do you have in the wp-content folder?

    Thread Starter soccerandtacos

    (@soccerandtacos)

    Thanks @autotutorial . I was sure to back everything up before making any changes haha!

    Unfortunately disabling the plugin did not allow me to upload images and the missing temporary folder error persisted.

    Permissions for the /wp-content folder are set to 755.

    I initially added this code to wp-config.php:

    define(‘WP_TEMP_DIR’,dirname(__FILE__).’/wp-content/temp’);

    I then added a /temp and a /tmp folder within /wp-content an assigned the appropriate permissions.

    I’m less sure about what you are suggesting here:

    However this code normally overrides the default folder in one you defined.
    because it doesn’t work I don’t know.
    https://developer.wordpress.org/reference/functions/get_temp_dir/

    $temp = WP_CONTENT_DIR . ‘/’;
    if ( is_dir( $temp ) && wp_is_writable( $temp ) ) {
    return $temp;
    }

    return ‘/tmp/’;
    https://github.com/WordPress/WordPress/blob/master/wp-includes/default-constants.php#L71
    WP_CONTENT_DIR I read this code will have the value of ABSPATH (root wordpress) wp-content for $temp = ABSPATH.’wp-content’.’/’ if it is a directory and writable return this otherwise /tmp/

    sorry, I thought you knew the programming, my mistake, forgive me.

    I’ll give you an example, I install wordpress in a subdirectory named wp.
    my absolute local path is
    /home/username/www/wp/
    then the ABSPATH constant was created to avoid ambiguously in the path of where wordpress resides.
    define('ABSPATH',dirname(__FILE__).'/');
    This is the same as the first path I wrote if wp-config.php or wp-settings.php is located in the wp directory.

    the correct code for the temp directory inside wp-content is
    define('WP_TEMP_DIR',dirname(__FILE__).'/wp-content/temp');
    try setting the right permissions:

    Read 4 – Allowed to read files
    Write 2 – Allowed to write/modify files
    eXecute1 – Read/write/delete/modify/directory

    Changing File Permissions

    Then try setting the wp-content folder and the temporary folder to 777.
    If it works for you we have to do other tests to understand how to limit the permissions 🙂

    you must also verify the owner file WordPress (wp-settings.php, /wp-content/ etc..) and therefore request support for your hosting for this.
    Create test.php into folder WordPress

    <?php
    $a[] = fileowner(dirname(__FILE__).'/');
    clearstatcache();
    $a[] = fileowner(dirname(__FILE__).'/wp-settings.php');
    clearstatcache();
    $a[] = fileowner(dirname(__FILE__).'/wp-content/');
    clearstatcache();
    print_r($a);

    This number is equal?

    Thread Starter soccerandtacos

    (@soccerandtacos)

    Hey @autotutorial , thanks for the detailed guidance, I really appreciate it. Everything is working as expected now that I set the permissions to rwx—— (ie, 01700). I figured this was a safer path than 777 as it prevents others from accessing the directory. Any thoughts on that?

    it depends on the owner of folders and files, via ftp or with my code it shows you the numbers that indicate the owner … The second method can be uncertain.
    Then check from the root until you get wp-content if the owner number is the same.
    syntax of the POSIX system UGO.
    U for owner (user)
    G for group (group user)
    O for other (other user)
    If it works, leave it like this .. so you have also changed good owner.
    https://en.wikipedia.org/wiki/Chmod#Special_modes

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Missing Temporary File and other errors’ is closed to new replies.