简体   繁体   English

Php 错误:无法打开 stream:CentOS 7.1.1503(核心)中的权限被拒绝

[英]Php Error : failed to open stream: Permission denied in CentOS 7.1.1503(Core)

I am running Apache/2.4.6 (CentOS) build Aug 24 2015 18:11:25 on CentOS Linux release 7.1.1503 (Core) 64-bit.我在 CentOS Linux 版本 7.1.1503(核心)64 位上运行 Apache/2.4.6(CentOS)构建 2015 年 8 月 24 日 18:11:25。 I am facing an issue while opening a file in 'w' mode and in 'a' mode also.我在以“w”模式和“a”模式打开文件时遇到问题。 I searched a lot for it.我搜索了很多。 Tried all mentioned steps but still I am not getting desired result.尝试了所有提到的步骤,但我仍然没有得到想要的结果。 The same file works and allows me to be opened in 'w' mode as well as in 'a' mode in my Windows 10. But it's not working in CentOS.相同的文件可以工作,并允许我在 Windows 10 中以“w”模式和“a”模式打开。但它在 CentOS 中不起作用。 There is file named ' home.php ' in the directory ' /var/www/html/editable '.在目录“ /var/www/html/editable ”中有一个名为“ home.php ”的文件。 When I try to open that file from the file srvr_file_access.php in 'w' mode or 'a' mode, I get the following error:当我尝试在“w”模式或“a”模式下从文件srvr_file_access.php打开该文件时,出现以下错误:

PHP Warning: fopen(/var/www/html/editable/home.php): failed to open stream: Permission denied in /var/www/html/srvr_file_access.php PHP 警告:fopen(/var/www/html/editable/home.php):无法打开 stream:/var/www/html/srvr_file_access.ZE1BFD762321E409CEE4166B 中的权限被拒绝

I have changed the owner and group of that file and directory to ' apache ' and have assigned permission 755 .我已将该文件和目录的所有者和组更改为“ apache ”并分配了权限 755 The permission for ' home.php ' file and directory are as follow: ' home.php '文件和目录的权限如下:

home.php主页.php

-rwxr-xr-x+ 1 apache apache 0 Oct 11 14:41 home.php

/var/www/html/editable /var/www/html/可编辑

drwxr-xr-x+ 2 apache apache   21 Oct 11 14:56 editable

Please can anyone help me to solve this issue?请问谁能帮我解决这个问题?

Thank you.谢谢你。

对于仍然存在此问题的任何人,我都通过在/ var中创建文件夹,然后使用chown apache:apache folder_name,然后在www文件夹中移动来解决它。

cd [laravelfolder] cd [laravel 文件夹]

chmod 777 storage -R sudo chcon -t httpd_sys_rw_content_t storage -R chmod 777 存储 -R sudo chcon -t httpd_sys_rw_content_t 存储 -R

chmod 777 bootstrap sudo chcon -t httpd_sys_rw_content_t bootstrap -R chmod 777 引导 sudo chcon -t httpd_sys_rw_content_t 引导 -R

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM