使用Systemd时,从PHP-FPM中看不到/tmp的内容 [英] Content of /tmp is not visible from PHP-FPM when using Systemd

查看:159
本文介绍了使用Systemd时,从PHP-FPM中看不到/tmp的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法从作为Systemd服务运行的PHP-FPM访问目录/tmp.

Directory /tmp is not accessible from PHP-FPM running as Systemd service.

复制步骤:

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

推荐答案

这是程序包维护者设置的默认行为. 这是因为/usr/lib/systemd/system/php-fpm.service中有PrivateTmp = true.

This is default behaviour set by package maintainers. It's because there is PrivateTmp=true in /usr/lib/systemd/system/php-fpm.service.

如果要更改它,可以创建包含以下内容的/etc/systemd/system/php-fpm.service.d/private-tmp.conf:

If you want to change it, you can create /etc/systemd/system/php-fpm.service.d/private-tmp.conf with contents:

[服务] PrivateTmp = false

[Service] PrivateTmp=false

这篇关于使用Systemd时,从PHP-FPM中看不到/tmp的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆