0

Linux dist: Ubuntu 18.04.5 LTS Server version: Apache/2.4.29 PHP Version: 7.4.20 with PHP-FPM

Recently this server did an automatic upgrade of Apache and ever since PHP can't write to /tmp breaking many sites. PHP functions like tmpfile() and move_uploaded_file() are returning false. PHP's file_put_contents() and fopen() when attempting to write to that folder also fail. sys_get_temp_dir() returns /tmp

The permission on /tmp is drwxrwxrwt which I understand is correct. I tried df -h and the disk is not anywhere close to running out of space or anything like that. The open_basedir setting in php.ini is blank which is also correct.

Any thoughts on how to fix this?

PHP Guru
  • 101
  • 1
  • 4
  • 1
    Where did you get PHP from? – Michael Hampton Jul 09 '21 at 01:41
  • 1
    Anything/anyone can write to `/tmp`. So, IMO your PHP code is likely not trying to write to `/tmp` but somewhere else. Check `upload_tmp_dir` in php.ini? see - https://stackoverflow.com/a/16091596/503621 – B. Shea Jul 09 '21 at 02:06
  • My temporary solution to this was to just restart the process php-fpm until Apache eventually fixed the problem in a subsequent update. This was resolved a while ago. I am just posting about it now. – PHP Guru May 31 '22 at 22:12

1 Answers1

0

Has the PHP-FPM service been "updated" to use the PrivateTmp setting?

If it has, then even though you ask for /tmp, PHP will not give you /tmp!
See php-fpm temporary file path problem.

Phill W.
  • 1,479
  • 7
  • 7