简体   繁体   English

使用Systemd时,从PHP-FPM中看不到/ tmp的内容

[英]Content of /tmp is not visible from PHP-FPM when using Systemd

Directory /tmp is not accessible from PHP-FPM running as Systemd service. 无法从作为Systemd服务运行的PHP-FPM访问目录/ tmp。

Steps to reproduce: 重现步骤:

<?php
print_r(shell_exec('ls /tmp'));
?>

This is default behaviour set by package maintainers. 这是软件包维护者设置的默认行为。 It's because there is PrivateTmp=true in /usr/lib/systemd/system/php-fpm.service. 这是因为/usr/lib/systemd/system/php-fpm.service中有PrivateTmp = true。

If you want to change it, you can create /etc/systemd/system/php-fpm.service.d/private-tmp.conf with contents: 如果要更改它,可以创建/etc/systemd/system/php-fpm.service.d/private-tmp.conf并包含以下内容:

[Service] PrivateTmp=false [服务] PrivateTmp = false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM