我有一个名为'files/crm-upload'的相对路径,想要上传文件。我的代码会检查is_writable()是否为true,只有在这种情况下才会继续执行。
该文件夹以rw和sec=sys挂载为NFS共享。
我编写了一个测试脚本,在Apache上执行,以查看访问权限,结果如下:
files/crm-upload/php_touch modification time has been changed to present time
My effective UID is 33 but my UID is really 33
files/crm-upload/ is owned by 33 and has permissions 40777
is_readable('files/crm-upload/') gives true
is_readable('files/crm-upload/php_touch') gives true
is_writable('files/crm-upload/') gives false
is_writable('files/crm-upload/php_touch') gives true
is_writable('files/crm-upload/25/') gives true
is_writable('files/images/') gives true
file_exists('files/crm-upload/') gives true
file_exists('files/crm-upload/php_touch') gives true
Some stat uids:
files/crm-upload/: 33
files/crm-upload/php_touch: 33
files/images/: 33
所以:
- 在共享文件上触摸可以工作
- UID 正确
- dir 有正确的权限
- 对于共享中的子文件夹和文件,is_writable 返回 true
这是一个 Ubuntu 18.04 客户端,没有运行 SELinux ...
ls -la
命令吗? - Andrei Lupuleasa