QuestionUnable to upload file to WordPress website hosted on Plesk: Missing temporary directory
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 0\\n', referer: https://example.com/wp-admin/upload.php
CausePHP /tmp folder has been removed recently with rm -rf /tmp/* command. The temporary folder might also be removed by 3rd party tools, like tmpreaper package.
Removal of PHP temporary folder resulted in inability to upload files on websites that use certain PHP-FPM handler.
ResolutionWarning: 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
1.Log into Plesk
2.Identify the PHP version used by the domain in Domains > example.com > PHP Settings:
(https://pix.cobrasoft.org/images/2024/12/12/mceclip0.png)
3.Restart the corresponding PHP service in Tools & Settings > Services Management by clicking the restart icon. This will recreate the temporary folder:
(https://pix.cobrasoft.org/images/2024/12/12/mceclip1.png)