Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
警告无法打开流权限被拒绝致命错误require#u once PHP+;NginX+;VMware中的RHEL_Php_Nginx_Vmware_Rhel - Fatal编程技术网

警告无法打开流权限被拒绝致命错误require#u once PHP+;NginX+;VMware中的RHEL

警告无法打开流权限被拒绝致命错误require#u once PHP+;NginX+;VMware中的RHEL,php,nginx,vmware,rhel,Php,Nginx,Vmware,Rhel,上下文:使用php.fpm在虚拟机上设置NginXRHEL 7.3。如果它包含纯html或简单php,我可以打开它。然而,当我使用require_一次(我已经检查了路径)时,我得到了下面的错误 Warning: require_once(/mnt/data/service/common/dbconfig.php): failed to open stream: Permission denied in /mnt/data/service/webcon/user.php on line 7 Fa

上下文:使用php.fpm虚拟机上设置NginXRHEL 7.3。如果它包含纯html或简单php,我可以打开它。然而,当我使用require_一次(我已经检查了路径)时,我得到了下面的错误

Warning: require_once(/mnt/data/service/common/dbconfig.php): failed to open stream: Permission denied in /mnt/data/service/webcon/user.php on line 7

Fatal error: require_once(): Failed opening required '/mnt/data/service/common/dbconfig.php' (include_path='.:/usr/share/pear:/usr/share/php') in /mnt/data/service/webcon/user.php on line 7
下面是我的www.conf在/php fpm.d中的片段

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
下面是/etc/nginx中我的nginx.conf的片段

user  apache;
worker_processes  auto;

error_log  /mnt/data/service/caldav/logs/error.log debug;
pid        /var/run/nginx.pid;
ps-aux | grep nginx显示:

root      43982  0.0  0.0  58756  1064 ?        Ss   15:07   0:00 nginx: master process /usr/sbin/nginx
apache    43983  0.0  0.0  61340  2624 ?        S    15:07   0:00 nginx: worker process
root      44199  0.0  0.0 112648   960 pts/1    S+   15:23   0:00 grep --color=auto nginx
我还将chmod 777分配给所有需要的父/子文件夹。目前,它们都归root/root所有。不知道我还需要做什么。我在谷歌搜索时找到的所有答案/建议都白费了

编辑1:

已尝试将用户组更改为www数据。获取下面的错误

Oct 26 15:32:25 nixs systemd[1]: Starting The PHP FastCGI Process Manager...
Oct 26 15:32:25 nixs php-fpm[44320]: [26-Oct-2017 15:32:25] ERROR: [pool www] cannot get uid for user 'www-data'
Oct 26 15:32:25 nixs php-fpm[44320]: [26-Oct-2017 15:32:25] ERROR: FPM initialization failed
Oct 26 15:32:25 nixs systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
Oct 26 15:32:25 nixs systemd[1]: Failed to start The PHP FastCGI Process Manager.
Oct 26 15:32:25 nixs systemd[1]: Unit php-fpm.service entered failed state.
Oct 26 15:32:25 nixs systemd[1]: php-fpm.service failed.
编辑2:

编辑3:


文件权限为644。目录设置为755

您执行了
CHMOD 777
CHMOD-R 777
,如果您执行了第一个,我建议您执行第二个


如果chmod不起作用,您可能需要执行CHOWN来分配文件夹和子文件夹中的用户,如下所示:
CHOWN-R apache:apache/mnt/data/…

将user:group更改为
www-data:www-data
@baig772,按您的建议执行。重新启动php-fpm.service时遇到另一个错误。更新了问题。谢谢你的提拉。:)你好,梅达利,CHMOD-R777和CHOWN都有。它仍然有相同的错误。请您共享以下输出:
ls-l/mnt/data/service/common/dbconfig.php
谢谢您的回复。用您请求的输出的屏幕截图更新了问题。这很奇怪,因为您的dbconfig.php文件具有777权限,无论如何都应该可以工作。您可以做些什么来确保文件权限没有问题(如果是这样,则非常奇怪:D)在您的根项目文件夹中执行chmod,如下所示
chmod-R 777/mnt/data/service
我假设您的根项目文件夹是/mnt/data/service,如果它不起作用,您还需要共享在user.php和index.php中生成的代码