This is a very short instructable about how to resolve the Missing Temporary Folder issue you often get in Wordpress. There are many posts on the Web which propose changing the wp-config.php file. However, I tried this and it didn't work. I was able to resolve it by editing my php.ini file which I will describe below.
Anyway, one of the images above shows the missing temporary folder error message that you receive when trying to adding new content in Wordpress, say an image or whatever.
After I resolved this, I found that I couldn't crop and save images. I will describe also how I resolved this.
Before you tackle this, ideally you should have command line interface (CLI) access to the Wordpress server and a reasonable knowledge of Linux. You can also do this in cpanel because it involves simply editing a file , i.e. php.ini. My server is a Debian 9 VPS and I am using Putty terminal emulator to access it from my laptop.
1. Create a new temporary folder in the WordPress content directory (e.g. cd /var/www/html/wordpress/wp-content) mkdir temp and ensure it has 755 permissions and owned by www-data.
2. Find php.ini on your server. Make sure you use the correct version if you have more than one.
<p>root@========:/var/www/html/wordpress/wp-content# find / -name php.ini<br>/etc/php/7.1/cli/php.ini /etc/php/7.1/apache2/php.ini /etc/php/7.0/cli/php.ini /etc/php/7.0/apache2/php.ini /etc/php/7.2/cli/php.ini /etc/php/7.2/apache2/php.ini root@========:/var/www/html/wordpress/wp-content# nano /etc/php/7.2/apache2/php.ini</p>
You can see that I still have other versions of php.ini but I need the latest one for php 7.2
3. Open your php.ini file (say using Nano as your editor - see insert below) and find and change the upload_tmp_dir directive to the temp folder you created as shown below. Php.ini is a large file so you will have to use Ctrl/W in Nano to search for it. It is uncommented by default. Change it as shown below then restart Apache (systemctl restart apache2), that's it. This should resolve the issue. Lastly, if you can can't crop and save images, install the PHP GD library sudo apt-get install php7.2-gd and restart Apache.
<p>php.ini</p><p>;;;;;;;;;;;;;;;;<br>; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. ; <a href="http://php.net/file-uploads" rel="nofollow"> <a href="http://php.net/file-uploads" rel="nofollow"> http://php.net/file-uploads </a> </a> file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ; <a href="http://php.net/upload-tmp-dir" rel="nofollow"> <a href="http://php.net/file-uploads" rel="nofollow"> http://php.net/file-uploads </a> </a> upload_tmp_dir = /var/www/html/wordpress/wp-content/temp/</p>
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.