Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open subdirectory of /tmp or /var/tmp #94

Open
jennik opened this issue Apr 16, 2017 · 0 comments
Open

Can't open subdirectory of /tmp or /var/tmp #94

jennik opened this issue Apr 16, 2017 · 0 comments

Comments

@jennik
Copy link

jennik commented Apr 16, 2017

I faced this problem while using xhprof and php-fpm on centos 7.

If you use php-fpm daemon configured to use private tmp directory (set to true by default in centos 7) and set xhprof.output_dir as subdirectory of /tmp, you probably notice than reports files can't be saved to that dir.
In that case you get the following message: "PHP Warning: fopen(/tmp/xhprof/58ed54f13807d.xhprof_testing.xhprof): failed to open stream: No such file or directory in /usr/share/pear/xhprof_lib/utils/xhprof_runs.php on line 136".
This happens because of php-fpm service cleans up /tmp directory each time the service started/restarted. So you have to create all subdirectories into /tmp each time you restart php-fpm.

Example:

$ cat /etc/php.d/xhprof.ini 
[xhprof]
extension=xhprof.so
xhprof.output_dir="/tmp/xhprof"
$ cat /usr/lib/systemd/system/php-fpm.service | grep PrivateTmp
PrivateTmp=true
$ sudo ls /tmp/systemd-private-b5096469cfb44152913c896b78570a6d-php-fpm.service-lP5PdF/tmp/xhprof
58f35870bd648.xhprof_testing.xhprof
$ sudo systemctl restart php-fpm
$ sudo ls /tmp/systemd-private-b5096469cfb44152913c896b78570a6d-php-fpm.service-EqBde7/tmp/xhprof
ls: cannot access /tmp/systemd-private-b5096469cfb44152913c896b78570a6d-php-fpm.service-EqBde7/tmp/xhprof: No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant