gpt4 book ai didi

PHP 无法读取/var/tmp 上的文件

转载 作者:可可西里 更新时间:2023-11-01 00:15:34 25 4
gpt4 key购买 nike

我有一个非常奇怪的错误。 PHP 无法读取确实存在的文件...一些想法?我没有安装 SELinux。我正在使用 fedora 17 和 php 5.4。

我已经尝试了所有我知道的方法,但问题仍然存在。

[root@sqd var]# ls -lia 
total 92
8194 drwxrwxrwx. 23 root root 4096 ago 17 10:30 .
2 dr-xr-xr-x. 19 root root 4096 ago 13 16:00 ..
32139 drwxr-xr-x. 2 root root 4096 may 22 13:42 account
288 drwxr-xr-x. 2 root root 4096 feb 3 2012 adm
13 drwxr-xr-x. 14 root root 4096 ago 8 10:26 cache
796005 drwxr-xr-x 2 root root 4096 feb 6 2012 cvs
289 drwxr-xr-x. 3 root root 4096 ago 21 18:07 db
290 drwxr-xr-x. 3 root root 4096 may 22 13:42 empty
263682 drwxr-xr-x. 3 root root 4096 ago 7 11:15 ftp
291 drwxr-xr-x. 2 root root 4096 feb 3 2012 games
35931 drwxrwx--T. 2 root gdm 4096 jun 8 16:05 gdm
292 drwxr-xr-x. 2 root root 4096 feb 3 2012 gopher
15 drwxr-xr-x. 45 root root 4096 ago 10 10:42 lib
296 drwxr-xr-x. 2 root root 4096 feb 3 2012 local
308 lrwxrwxrwx. 1 root root 11 may 22 13:39 lock -> ../run/lock
12 drwxr-xr-x. 14 root root 4096 ago 26 03:17 log
297 lrwxrwxrwx. 1 root root 10 may 22 13:39 mail -> spool/mail
298 drwxr-xr-x. 2 root root 4096 feb 3 2012 nis
931987 drwxrwxrwx 3 nobody nobody 4096 ago 17 10:32 nodejs
299 drwxr-xr-x. 2 root root 4096 feb 3 2012 opt
300 drwxr-xr-x. 2 root root 4096 feb 3 2012 preserve
307 lrwxrwxrwx. 1 root root 6 may 22 13:39 run -> ../run
301 drwxr-xr-x. 15 root root 4096 may 22 13:43 spool
305 drwxrwxrwx. 5 nobody nobody 4096 ago 30 14:13 tmp
262637 drwxr-xr-x. 7 root root 4096 ago 7 11:20 www
306 drwxr-xr-x. 2 root root 4096 feb 3 2012 yp


[root@sqd var]# ls -lia tmp/
total 216
305 drwxrwxrwx. 5 nobody nobody 4096 ago 30 14:13 .
8194 drwxrwxrwx. 23 root root 4096 ago 17 10:30 ..
3030 -rwxrwxrwx 1 nobody nobody 199397 ago 30 14:13 file_thumb_5363_1_0.jpg

但是

<?php
highlight_file(__FILE__);

var_dump(file_exists('/var/tmp/file_thumb_5363_1_0.jpg'));

打印出来:

bool(false) 

最佳答案

Fedora 16 引入了“私有(private) tmp/tmp/var/tmp 的概念会在那个方向上投入我的 2 美分。

From the manual :

2.3.3. Services Private /tmp
A number of services managed by systemd have been modified to make use of its ability to provide them with a private /tmp directory. Privileged services using /tmp and /var/tmp have previously been found to be open to being interfered with by unprivileged users, potentially leading to privilege escalation. Using private /tmp directories for services prevents this style of exploit.

The directive added to the systemd unit files for the modified services is:

[Service]
PrivateTmp=true

关于PHP 无法读取/var/tmp 上的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12206857/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com