当前位置: 首页 > 工具软件 > put2win > 使用案例 >

[乐意黎]Centos下关于fopen和file_put_contents方法抛failed to open stream: Permission denied的解决方法

常炯
2023-12-01

1. Warning: fopen(目录路径/文件名)failed to open stream: Permission denied
如:

Warning: fopen(/usr/local/website/aerchi.com/***.json): failed to open stream: Permission denied in /usr/local/website/aerchi.com/***/***.php on line 16

目录路径:  /usr/local/website/aerchi.com

文件名:   ***.json

解决:  

[root@aerchi.com ~]#   touch 目录路径
[root@aerchi.com ~]#   chmod -R 755 目录路径/*


2. Warning:  file_put_contents(目录路径/文件名): failed to open stream: Permission denied in 调用文件路径 on line 1417

如:
Warning:  file_put_contents(/usr/local/website/aerchi.com/***.json): failed to open stream: Permission denied in /usr/local/website/aerchi.com/***/***.php on line 141

目录路径:  /usr/local/website/aerchi.com

文件名:   ***.json

解决:  

注: daemon 为 apache httpd 的帐户名

[root@aerchi.com ~]#   chown -R daemon 目录路径/* && chmod 755 -R 目录路径/*


乐意黎

2018-07-05

 类似资料: