Many of us had faced the issue previously. Also, many of our clients contacted us because they had the same issue. So, we're writing the topic to help those who had the issue earlier. Follow each of those instructions to solve the issues!
Create a file at the root directory of your WordPress site with any name, for example: phpinfo.php. Open the file and add the following line:
And save the changes! Then open the file at your web browser's tab. And check the value of upload_tmp_dir. If there's no value mentioned, it will call/define itself automatically /tmp. There is no requirement to perform any changes, but you still can perform the changes by adding a value.
For the cPanel/WHM server, open WHM (root). Go to the "MultiPHP INI Manager", select the menu Advanced, click on Editor and search for the value upload_tmp_dir with Ctrl + F. and put the value:
upload_tmp_dir = /tmp
Make sure to uncomment the line, by removing ; and then save the changes! Now, run the following command lines on the Terminal:
This will apply the changes immediately. Do the same changes for all the ea-php (versions) of your server.
Also check the topic: [ How to switch from mod_ruid2 to mod_suexec? ]
Open the File Manager of your hosting or the FTP with the correct domain name where you're facing the issue. Switch to the public_html directory, and open the wp-confg.php file with an editor. You need to paste this code to the file just before the line that says ‘That’s all, stop editing! Happy publishing.’
define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');
Save your changes and upload the wp-config.php file back to your website. Next, you need to go to the /wp-content/ folder and create a new folder inside it. You should name this new folder temp. That’s all. You can now visit your WordPress admin area and try uploading an image.
If you still see the ‘Missing temporary folder’ error message, then you’ll need to check the directory permissions for your wp-content folder. Using your FTP client or, File Manager, go to the root folder of your WordPress site. After that, you should right-click on the wp-content folder and select ‘File permissions…’ This will bring up the file permissions dialog box. Now you need to enter 755 in the numeric value field. Click on the OK button to continue.
Or, you can do the changes through the Terminal. Go to the root folder of your WordPress site (example: public_html). Make sure to check the current path by running the command: pwd
cd public_html && chmod 755 wp-content
Also, check the file/directory permissions with the chown command binary!