file_put_contents 无法打开流:权限被拒绝

file_put_contents failed to open stream: Permission denied

基本 php 和 javascript 网站 Wamp 上没有错误 当我将文件放在我的 Lamp 服务器上时,除了这个错误之外,一切正常,我进入了页面顶部

Warning: file_put_contents(donneesDonut.json): failed to open stream: Permission denied in /var/www/html/bp/action/IndexAction.php on line 101

我环顾四周,大多数人建议更改 apache 上文件或整个目录的权限。 chmod 777 对我没有任何作用。

我是网络服务器的新手,所以我可能在安装过​​程中错过了一些 apache 权限配置

这是目录的截图 Directory listing

我认为代码没有问题,因为它可以在我的本地 Wamp 服务器上运行,但这是给我错误的代码行。

file_put_contents($this->json, json_encode($this->donneesDonut));

如果您需要任何其他信息,例如特定的 apache 配置,请告诉我从哪里获得它们。

希望能帮到你

问题是 SELinux 在 Centos 上默认设置为强制执行