简体   繁体   English

警告无法打开流权限拒绝致命错误require_once PHP + NginX + RHEL in VMware

[英]Warning failed to open stream permission denied fatal error require_once PHP + NginX + RHEL in VMware

Context: Set up NginX with php.fpm on a virtual RHEL 7.3 . 背景:设置使用nginx的 php.fpm上的虚拟 RHEL 7.3。 I'm able to open http://hostname/webcon/index.php if it contains plain html or simple php. 如果http://hostname/webcon/index.php包含纯HTML或简单php,则可以打开。 However, when I use require_once (I've checked the path), I'm getting the below error. 但是,当我使用require_once(检查路径)时,出现以下错误。

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

Here is the snippet of my www.conf in /php-fpm.d 这是我在/php-fpm.d中的www.conf的片段

; 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

Here is the snippet of my nginx.conf in /etc/nginx 这是我在/ 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 | ps -aux | grep nginx shows: 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

I have also assigned chmod 777 to all the parents/sub-folders required. 我还将chmod 777分配给了所需的所有父/子文件夹。 All of them are owned by root/root for now. 目前所有这些都归root / root拥有。 Not sure what else I need to do. 不知道我还需要做什么。 I have tried in vain all the answers/suggestions I've found while Googling.. 我在搜寻Google时发现的所有答案/建议都徒劳无功。

Edit 1: 编辑1:

Tried changing user:group to www-data. 尝试将user:group更改为www-data。 Get the error below. 得到下面的错误。

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.

Edit 2: 编辑2:

ls -l dbconfig.php的屏幕截图

Edit 3: 编辑3:

File permissions are 644. Directories are set to 755. 文件权限为644。目录设置为755。

you did CHMOD 777 or CHMOD -R 777 , if youd have executed the first one I suggest you to do the second one. 如果您已执行第一个,则您执行过CHMOD 777CHMOD -R 777 ,我建议您执行第二个。

If chmod is not working, maybe you need to do a CHOWN to assign the user in your your folder and subfolder like this : CHOWN -R apache:apache /mnt/data/... 如果chmod不起作用,也许您需要执行CHOWN来在您的文件夹和子文件夹中分配用户,如下所示: CHOWN -R apache:apache /mnt/data/...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP require_once 无法打开流权限被拒绝 - PHP require_once failed to open stream permission denied 警告:require_once(../initialize.php):无法打开 stream 和致命错误:require_once():无法打开所需的问题 - Warning: require_once(../initialize.php): failed to open stream and Fatal error: require_once(): Failed opening required problem require_once(“ facebook-sdk / facebook.php”)引发警告“无法打开流:权限被拒绝” - require_once(“facebook-sdk/facebook.php”) throws a warning “failed to open stream:Permission denied” require_once:无法打开流:权限被拒绝(lampp) - require_once: failed to open stream: Permission denied(lampp) require_once(../../ path / to / script.php)打开流权限被拒绝 - require_once(../../path/to/script.php) failed to open stream permission denied PHP警告:require_once:无法打开流:在目录中没有这样的文件或目录 - PHP Warning: require_once: failed to open stream: No such file or directory in PHP 警告:require_once 无法打开流:中没有这样的文件或目录 - PHP Warning: require_once failed to open stream: No such file or directory in PHP 警告:require_once(/var/www/html/wp-config.php):无法打开流:第 37 行 /var/www/html/wp-load.php 中的权限被拒绝 - PHP Warning: require_once(/var/www/html/wp-config.php): failed to open stream: Permission denied in /var/www/html/wp-load.php on line 37 (include/DB_Functions.php) 无法打开 stream: & 致命错误: require_once() - (include/DB_Functions.php) failed to open stream: & Fatal error: require_once() PHP require_once 给出无法打开 stream 错误 - PHP require_once giving an failed to open stream error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM