我有一个由Zend Server部署的Laravel 5项目,一切似乎工作正常,直到我的代码出错,导致框架需要写入日志文件。那时ZRay向我显示了这个错误
未捕获的异常'UnexpectedValueException',消息'流或文件“/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log”无法打开:无法打开流:权限被拒绝'/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:97 Stack跟踪:#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 - >写(数组)#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/照明/日志/令状er.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->错误(对象(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-&gt ; report(Object(UnexpectedValueException))#8 [内部函数]:Illuminate \ Foundation \ Bootstrap \ HandleExceptions-> handleException(Object(UnexpectedValueException))#9 {main}抛出
这里的问题是文件
/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log
不仅归我所有,该群组 zend 且文件权限 777 。我已尝试此文件的所有用户/组/模式权限,但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
关于在哪里寻找可能的罪魁祸首的任何想法?
谢谢, 保罗
答案 0 :(得分:1)
检查regexp_replace
。要访问文件,您必须具有所有父目录的执行权限。在你的情况下
/usr/local
/usr/local/zend
storage/logs
依旧......
似乎您对应用程序文件夹拥有正确的权限,但function _helperFunction(){
// do something
// return something
}
var exposedFunction = function() {
// do something
var x = _helperFunction();
// Do something else
}
module.exports = {
exposedFunction : exposedFunction
};
出现了问题。检查此目录的执行权限。
答案 1 :(得分:1)
日志文件应由zend服务正在运行的同一用户拥有。通常这是"没有人"或者" apache"
虽然您的文件暗示它由自己的用户拥有,但我会首先检查您的Web服务器正在运行 我会跑一个 ps -ef | grep |更
通常是httpd(适用于CentOS / RHEL) 要么 apache2 for ubuntu
ps -ef | grep httpd |更多
答案 2 :(得分:0)
我在昨晚深夜找到了权限,如果手动完成,我可以在部署后让网站正常工作。然后,这引出了另一个问题here
仅供参考:执行权限是在整个路径部分设置的,但无论如何链接都是一个很好的阅读,所以谢谢Andrew