我在Linux上有一个名为mygroup的小组。 并有一个名为 Apache 的用户。 Apache 是 MyGroup 的成员。
我创建了一个示例 PHP 文件并上传到 Sever(服务器)
<?php
$structure = '/my_repo/hello';
if (!mkdir($structure, 0, true)) {
die('Failed to create folders...');
}
?>
Myrepo Dir 位于根级别,是组是 MyGroup,所有者是根。 权限为 764。
当我在 http://mydomain.com/sample.php 上访问我的文件
它给了我以下错误
[warn] mod_fcgid: stderr: PHP Warning: dir(/my_repo/hello)
[<a href='function.dir'>function.dir</a>]: failed to open dir:
Permission denied in /var/www/clients/client1/web2/web/sample.php
问题已解决。 服务器上存在权限问题。 代码是通过其他用户上传的,该用户没有MyRepo目录的权限。