If you are using Centos 7 and have installed Apache or PHP-FPM through yum, then you most probably will face the following problem:
Files created in /tmp directory by Apache CGI’s or PHP, seems to be missing
The reason for this is another “great” Systemd feature, called “Private Temp“.
This security orientated feature is used in order to prevent milicious software uploading and executing malicious code from /tmp directory.
The setting could be find in your Systemd service files, and looks like this:
This is the default option for services like Apache, php-fpm, Mariadb.
When this option is enabled and you try to create temporary file in /tmp, it will be created in a random generated tmp dir, looking like this:
Disabling “PrivateTmp” for a given service
1. Edit the service file and change PrivateTmp from “true” to “false”
2. Reload systemd
3. Finally restart the affected service
systemctl restart httpd # If our changes were made to Apache