我没有 open_basedir,php 可以访问 /etc /usr /proc /home 等......但不能访问 /tmp。
tmpfs 安装在 /tmp (/tmp type tmpfs (rw)) 这也是我想使用 /tmp 文件夹的原因。
我的文件归 http(nginx 和 php 的用户)所有,每个人都可以阅读。
sudo -u http cat /tmp/file 正在运行,但 php 脚本中的任何内容都不起作用(如 file_exist() 或 file())。
编辑:日志中显示的错误:
PHP Warning: file(/tmp/ydlw/pid): failed to open stream: No such file or directory in /srv/http/ydlw/status.php on line 267
Run Code Online (Sandbox Code Playgroud)
编辑2:我以另一种方式测试了这个问题。我做了
touch("/tmp/boo");
file_exist("/tmp/boo");
Run Code Online (Sandbox Code Playgroud)
和 file_exist 返回 true 以便创建文件。然后我在 /tmp 里面看了看,在那里找不到“boo”文件。这就是我所害怕的,php 看不到挂载点。为什么会这样,我该如何解决?