以前用的比较多的 Linux
是 Ubuntu
,今天在 CentOS
上搭建环境时无论如何修改用户权限为 777
或者 755
、变更文件所属用户, Laravel
框架总是报错 "The stream or file "/var/www/laravel56/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied"
最终找到问题根源:
是selinux 开启造成的,具体selinux的介绍大家可以自行百度
解决办法:
编辑
/etc/selinux/config
文件,将SELINUX
项修改为:SELINUX=disabled
#This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted
问题解决!
由于本人学艺不精,未尽之处还望海涵,有误之处请多多指正,欢迎大家批评指教
本文 完