You are here

PHP cannot write to tmpfs and maybe /tmp

So this is a hard one to describe on google but it's an important issue I came across while building a new control panel for CENTOS 7.
I needed to access a tmpfs system for read and write. After using php to create files, the files were not appearing in the new location. Low and behold it was because of this issue related to a systemd setting for the php-fpm.service
The setting was set as follows
PrivateTmp=true

I changed that to PrivateTmp=false then restarted the service and now php can access the correct tmpfs folder I mounted.

More details: https://www.the-art-of-web.com/php/where-is-tmp/