I have a Laravel 5 project deployed by Zend Server, and everything seemed to be working fine until I got an error in my code, which caused the the framework to need to write to the log file. At that point ZRay shows me this error
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
The problem here is that the file
/usr/local/zend/var/apps/http/vtribes.local/80/2.1_33/storage/logs/laravel.log
is not only owned by me, the group is zend and the file permission is 777. I have tried all user/group/mode permissions on this file, but ZRay still shows the same error. I even deleted the file and then touched it.
-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
Any thoughts on where else to look for a possible culprit?
Thanks, Paul
I figured out the permissions late last night, and if done manually I can get the site to work after a deploy. This then leads me to another question here
FYI: The execute permission was set on the entire path parts, but the link was a good read anyway, so thanks Andrew