我们有一个Apache服务器,在Ubuntu系统上运行php7.4。Apache用户是默认用户www-data。我的网站位于以下文件夹中:/var/www/html/contract-request
,并且递归地具有以下权限drwxrwxr-- 3 www-data www-data
,因此组和所有者具有完全访问权限。我自己的用户也在www-data组中。
现在有些文件在不同的文件夹中。它们主要是生成的文件和附件。它们位于以下路径中:
$ ll /var/www/data/contract-request/
total 32
drwxrwxr-- 5 www-data www-data 4096 Feb 22 14:28 ./
drw-rwxr-- 5 www-data www-data 4096 Apr 19 08:57 ../
drwxrwxr-x 3 www-data www-data 4096 Nov 3 2022 application_file/
drwxrwxr-x 2 www-data www-data 4096 Feb 22 14:28 archive/
drwxrwxr-x 3 www-data www-data 16384 Feb 24 12:05 attachment/
看到了吗?同一个组,用户和组也有完全的访问权限。
现在就奇怪了。我在我的php应用程序中的错误string(108310) "Exception information: Message: FritIdentifierDocumentStructure: the path /var/www/data/contract-request/application_file doesn't exist.
在以下行:
if (!is_dir($this->strBasePath)) {
throw new Exception('FritIdentifierDocumentStructure: the path '
. $this->strBasePath . ' doesn't exist.');
}
好吧.....
所以我写了一个小测试脚本,并将其放置在服务器文档根目录中:
if(!is_dir('/var/www/data/contract-request/application_file')) {
echo 'Nope. Nothing!'.PHP_EOL;
} else {
echo 'Found it!'.PHP_EOL;
}
当我从客户端$ php test.php
运行脚本时,一切正常。但是当我从浏览器调用相同的脚本时,我得到的结果是“不”。什么都没有!”
/var/www/data/可能是一个外部系统,它被挂载,但这应该没有什么区别。整个系统都在Google云中。
$ cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 discard,errors=remount-ro 0 1
LABEL=UEFI /boot/efi vfat umask=0077 0 1
10.xx.xx.xx:/vol-d-shared-host-201/zzz-d-iadm-intra/gl-d-xxx-xxintra7/opt /opt nfs rw,hard,rsize=65536,wsize=65536,vers=3,tcp 0 0
10.xx.xx.xx:/vol-d-shared-host-201/zzz-d-iadm-intra/gl-d-xxx-xxintra7/var-www/data /var/www/data nfs rw,hard,rsize=65536,wsize=65536,vers=3,tcp 0 0
//nas002.zzz-mobile.de/projects /home/System/web-prj cifs vers=1.0,dir_mode=0777,file_mode=0777,uid=www-data,gid=www-data,noserverino,nounix,rw,mfsymlinks,x-systemd.requires=/opt/zzz/cifs,credentials=/opt/zzz/cifs/cifs-credentials.nas002 0 0
有人知道原因吗?
1条答案
按热度按时间55ooxyrt1#
正如托马斯在这里提到的:
注意,在Linux上,如果父目录没有为php进程设置+x(可执行文件),is_dir将返回FALSE。
由于挂载点没有可执行权限,
is_dir
返回false。