Why can't I see /tmp content with Php-FPM?

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » CustomBuild » ./build php » php-FPM

Why can't I see /tmp content with Php-FPM?Last Modified: Aug 21, 2014, 11:49 pm
With CentOS 7, you may have noticed that even though your script may working as expected, you're not able to see the session files or temporary files in the /tmp folder.

The reason for this, is that with CentOS 7 supports a feature called:


What this feature does, is mounts /tmp and /var/tmp as private file systems, visible only to that process.  So when php-fpm writes to /tmp, it's not the /tmp that you can see from ssh.. it's a virtual path, visible only to that process.  Once the process stops, the virtual /tmp is removed.

Man page from systemd.exec:

          Takes a boolean argument. If true, sets up a new file system namespace for the executed processes and mounts private /tmp and /var/tmp directories inside it, that
          are not shared by processes outside of the namespace. This is useful to secure access to temporary files of the process, but makes sharing between processes via
          /tmp or /var/tmp impossible. All temporary data created by service will be removed after service is stopped. Defaults to false.

If you don't like this behavior, edit:


and set PrivateTmp=false, and restart php-fpm (adjust 55 to whichever version you have)

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST