• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • 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.

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