• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue PHP upload fails with "File upload error - unable to create a temporary file" after CentOS 7 update

SteveITS

Basic Pleskian
Server is CentOS Linux release 7.9.2009 (Core). A web site uploads a CSV file for import. I am told it worked approximately Jan. 20. On Jan. 27 we installed CentOS updates. As the server admin I made no other recent changes and Plesk updated in early January. This week when the user tried to import it logged:

[Tue Feb 02 08:15:12.000066 2021] [proxy_fcgi:error] [pid 2759:tid 140256493913856] [client x.x.x.x:48434] AH01071: Got error 'PHP message: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0\n', referer: https://server/import.php

In the PHP settings for the web site if I set "upload_tmp_dir=/tmp" then the upload works.

Per Zend, PHP should use the system tmp dir if unset. Since there was no code changes on this site, I am confused why it would stop working. The site is old so it is using PHP 5.6 (yes I know) so PHP was not updated last month.

Has anyone else seen this? Or have any idea why it would start happening?
 
I suppose that cleaning up /tmp folder during system update resulted in the fact that /tmp for the PHP-FPM does not exist.
You have to restart the PHP service used by the domain. This will recreate the temporary folder in /tmp:

# service plesk-phpXX-fpm restart
 
Hi Igor, I see... I didn't get that far, but if I remove "upload_tmp_dir = /tmp" the upload works. So likely you are correct that adding the setting would have restarted the site and/or PHP.

So is the default for Plesk+PHP FPM the /tmp/systemd-private-7441f87e6af24cb2a6d3c32345887352-plesk-php56-fpm.service-lnbmT1/tmp/ directory?

Edit: if I show the output, PHP ($_FILES["csvfile"]["tmp_name"]) says the file is uploaded as /tmp/phpEyDC8h, not the above directory.
 
Last edited:
"/tmp/phpEyDC8h" is session related. In other sessions it will have a different name.
 
"/tmp/phpEyDC8h" is session related. In other sessions it will have a different name.
Hmm, so why did it fail until I put in that setting and (apparently more importantly) triggered a PHP restart? /tmp did exist of course. Unless something disconnected the running PHP process from tmp? Or it uses the longer path and moves the file into /tmp? (inquiring minds want to know...)
 
Back
Top