PHP can’t write to /tmp folder anymore after Apache update

apache-2.4file-permissionsphp-fpmtmpubuntu-18.04

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?

Best Answer

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.