问题
Directory /tmp is not accessible from PHP-FPM running as Systemd service.
Steps to reproduce:
<?php
print_r(shell_exec('ls /tmp'));
?>
回答1:
This is default behaviour set by package maintainers. It's because there is PrivateTmp=true in /usr/lib/systemd/system/php-fpm.service.
If you want to change it, you can create /etc/systemd/system/php-fpm.service.d/private-tmp.conf with contents:
[Service] PrivateTmp=false
来源:https://stackoverflow.com/questions/21615786/content-of-tmp-is-not-visible-from-php-fpm-when-using-systemd