How to Fix “Missing a Temporary Folder” Error in WordPress

Translate the Page

BeAnExpert.online

Hi Friends,

Hope you are well.

Yesterday, I faced a new issue in WordPress. The issue was “While uploading the image into the WordPress panel, I was getting the below error”

Missing a Temporary Folder

So I just wanted to share the fix for such issue.

What Causes The ‘Missing a Temporary Folder’ Error in WordPress?

This error is caused by incorrect PHP settings on the WordPress hosting environment. There is a specific PHP setting that defines a temporary folder to be used by apps like WordPress to temporarily store data before saving it to the desired location.

WordPress needs access to this temporary folder whenever you upload an image, install or update a theme or plugin, or update WordPress core. So if the location of this folder is not defined in your server’s PHP configuration or your site’s PHP configuration (local PHP configuration), then WordPress will be unable to do any of these things and it will show you ‘Missing a temporary folder’ error.

 

Fix “Missing a Temporary Folder” Error in WordPress:

To resolve the issue, there are 2 solutions/options.

The first option is:

 

  1. Log into cPanel account or use your FTP.
  2. Locate wp-config.php file in the root of your wordpress site.
  3. Download the file and open it in any text editor.
  4. Add following code after /* That’s all, stop editing! Happy blogging. */:                                           define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');
  5. Save the file and replace it on your server.
  6. Create a new folder temp in wp-content folder.

The second option is:

 

  1. Log into cPanel account or use your FTP.
  2. Open public_html folder.
  3. Now create a file with a name php.ini (EasyApache3). For EasyApache4, create a file .user.ini.
  4. Place the following code inside the file:                                                                                                upload_tmp_dir= /home/username/public_html/temp/
  5. Save the file.
  6. Create a temp folder at the same location, i.e. inside public_html.

The issue will be resolved by following either of above 2 options. Even after following the above 2 steps, if it is not fixed, then change the PHP version of the domain from your control panel. This will automatically add the required temp folder as other PHP version do have these things ( Please note that different PHP version has different PHP settings, so changing the PHP version might break the site). At the worst case only, try changing the PHP version and test the issue with images in WordPress. Once you confirm that it is working fine ( you are able to upload it without any issue), then check the functionality of the site as well. You can also consult a WordPress developer to know whether your site is compatible with your new version of PHP or not.

I hope this will help you in fixing the above issue. If you still face any issue or have any question, feel free to comment in the below comment section. If you want to contact us via email, you can use the “Contact Us” tab listed at the below right side of every page.

Join our newsletter or subscribe our blog to get the updates of every post in your mailbox.

Thank you.

My name is Shashank Shekhar. I am a Software Engineer, currently working in one of the leading web-hosting companies in India. I am having 2 years of experience in Linux Server Administration.

I love to work in Linux environment & love learning new things.

Powered by Facebook Comments

Be the first to comment

Leave a Reply