Symptoms
-
Unable to upload a file in WordPress > example.com > Log in > Media > Add New with the following error
Missing temporary directory
OR
Missing a temporary folder
-
There are the following records in
/var/www/vhosts/system/example.com/logs/error_log
file:AH01071: Got error ‘PHP message: PHP Warning: File upload error – unable to create a temporary file in Unknown on line 0n’, referer: https://example.com/wp-admin/upload.php
Cause
/tmp
folder has been cleaned up recently with rm -rf /tmp/*
. The temporary folder can also be cleaned by 3rd party tools that delete temporary files such as tmpreaper
package.
Cleaning up /tmp
folder resulted in the fact that /tmp
for the PHP-FPM does not exist.
Resolution
Warning: If there is a 3rd party tool software deleting the temporary files, such as tmpreaper
package, make sure to configure it properly or uninstall it from the system to avoid any conflict with Plesk and other services
-
Identify the PHP version used by the domain in Domains > example.com > PHP Settings:
-
Restart the PHP service in Tools & Settings > Services Management by clicking the yellow restart icon. This will recreate the temporary folder: