日志文件权限错误
Log file permissions error
我有一个由 Zend Server 部署的 Laravel 5 项目,一切似乎都运行良好,直到我的代码出现错误,导致框架需要写入日志文件。那时 ZRay 向我显示了这个错误
Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:97 Stack trace: #0 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array) #3 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array) #4 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueException), Array) #5 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(56): Illuminate\Log\Writer->error(Object(UnexpectedValueException)) #6 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/app/Exceptions/Handler.php(36): Illuminate\Foundation\Exceptions\Handler->report(Object(UnexpectedValueException)) #7 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): App\Exceptions\Handler->report(Object(UnexpectedValueException)) #8 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(UnexpectedValueException)) #9 {main} thrown
这里的问题是文件
/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log
不仅是我的,群组是zend,文件权限是777。我已经尝试了这个文件的所有 user/group/mode 权限,但 ZRay 仍然显示相同的错误。我什至删除了文件然后触摸它。
-rwxrwxrwx. 1 paul zend 0 May 24 00:17 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log
关于在其他地方寻找可能的罪魁祸首的任何想法?
谢谢,
保罗
勾选this answer。要访问文件,您必须对所有父目录具有执行权限。你的情况
/usr
/usr/local
/usr/local/zend
等等...
您似乎对应用程序文件夹具有正确的权限,但 storage/logs
有问题。检查此目录的执行权限。
日志文件应该属于同一用户,因为 zend 服务是 运行ning。通常这是 "nobody" 或 "apache"
虽然您的文件暗示它归自己的用户所有,但我会先检查一下您的 Web 服务器是什么 运行ning
我会 运行
ps-ef |搜索引擎优化 |更多
通常是它的 httpd(对于 CentOS/RHEL)
要么
ubuntu
的 apache2
ps-ef | grep httpd |更多
我昨晚弄清楚了权限,如果手动完成,我可以在部署后让站点运行。这又引出了另一个问题 here
仅供参考:在整个路径部分都设置了执行权限,但是 link 无论如何都值得一读,所以感谢 Andrew
我有一个由 Zend Server 部署的 Laravel 5 项目,一切似乎都运行良好,直到我的代码出现错误,导致框架需要写入日志文件。那时 ZRay 向我显示了这个错误
Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:97 Stack trace: #0 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array) #3 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array) #4 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueException), Array) #5 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(56): Illuminate\Log\Writer->error(Object(UnexpectedValueException)) #6 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/app/Exceptions/Handler.php(36): Illuminate\Foundation\Exceptions\Handler->report(Object(UnexpectedValueException)) #7 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): App\Exceptions\Handler->report(Object(UnexpectedValueException)) #8 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(UnexpectedValueException)) #9 {main} thrown
这里的问题是文件
/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log
不仅是我的,群组是zend,文件权限是777。我已经尝试了这个文件的所有 user/group/mode 权限,但 ZRay 仍然显示相同的错误。我什至删除了文件然后触摸它。
-rwxrwxrwx. 1 paul zend 0 May 24 00:17 /usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log
关于在其他地方寻找可能的罪魁祸首的任何想法?
谢谢, 保罗
勾选this answer。要访问文件,您必须对所有父目录具有执行权限。你的情况
/usr
/usr/local
/usr/local/zend
等等...
您似乎对应用程序文件夹具有正确的权限,但 storage/logs
有问题。检查此目录的执行权限。
日志文件应该属于同一用户,因为 zend 服务是 运行ning。通常这是 "nobody" 或 "apache"
虽然您的文件暗示它归自己的用户所有,但我会先检查一下您的 Web 服务器是什么 运行ning 我会 运行 ps-ef |搜索引擎优化 |更多
通常是它的 httpd(对于 CentOS/RHEL) 要么 ubuntu
的 apache2ps-ef | grep httpd |更多
我昨晚弄清楚了权限,如果手动完成,我可以在部署后让站点运行。这又引出了另一个问题 here
仅供参考:在整个路径部分都设置了执行权限,但是 link 无论如何都值得一读,所以感谢 Andrew