Applicable to:
- Plesk for Linux
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_logfile:
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
-
Corresponding PHP-FPM service has PrivateTmp enabled:
# systemctl cat plesk-php83-fpm.service | grep PrivateTmp
PrivateTmp=trueNote: the PHP version can be identified in Domains > example.com > PHP Settings.
-
PrivateTmp=truemeans that uploaded files use directory like below:/tmp/systemd-private-a843c1c414a649b6a153d621c2607c9e-plesk-php83-fpm.service-UuymOU/tmp/
Cause
PHP /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.
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 corresponding PHP service in Tools & Settings > Services Management by clicking the restart icon. This will recreate the temporary folder:
If the error still triggers after restarting PHP service, do the following:
-
Navigate to Domains > example.com > PHP Settings
-
Change PHP parameter
open_basedirtononeand press Apply button. -
Revert the changes, and press Apply button again.
Comments
Please sign in to leave a comment.