[Wed Apr 06 07:18:08.672061 2016] [:error] [pid 21071] [client 151.241.55.221:63410] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/mySite/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/mySite/bootstrap/cache/compiled.php:13422\nStack trace:\n#0 /var/www/mySite/bootstrap/cache/compiled.php(13360): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/mySite/bootstrap/cache/compiled.php(13123): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#2 /var/www/mySite/bootstrap/cache/compiled.php(13219): Monolog\\Logger->addRecord(400, Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#3 /var/www/mySite/bootstrap/cache/compiled.php(12936): Monolog\\Logger->error(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#4 /var/www/mySite/bootstrap/cache/compiled.php(12907): Illuminate\\Log\\Writer->writeLog('error', Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#5 /var/www/mySite/vendor/laravel/framework/src/Illumin in /var/www/mySite/bootstrap/cache/compiled.php on line 13422
~
What are the permissions on the storage and logs directories? The laravel.log file?
Is this error triggered from web or running an artisan command? If you ran some code from the command line and the log file did not exist, it would have been created with the executing user's permissions, which would mean that Apache has no access to write to it, irrespective of the directory permissions.
Try chown -R apache:apache storage/logs and see if that helps.
@hoseinz3, Similar to @deringer was getting at, since we're talking about permissions based on 'who' is trying to write to the file, it would probably be worth it to verify who is running httpd. ps aux|grep httpd should get you that info. Judging by your perms, it should be user apache, but it's worth checking. Is this a new install or has this worked in the past and now stopped working? I'm also curious what ls -l /var/www/mySite/storage/logs/laravel.log produces.
Is selinux enabled? Run sestatus to check. If it is you can temporarily disable it by running setenforce 0 - to change the selinux permissions you might have to do something like :
@ohffs If it makes you feel any better, I'm totally guilty of this also. In Centos, it's usually not long after a fresh install that I'm editing /etc/sysconfig/selinux, setting SELINUX=disabled, and rebooting. To make myself feel better, I'm pretty particular about my iptables config and I am not usually exposing very many services to the world.
@goatshark if it wasn't quite so arcane I'd be all over it :-/ Luckily 99% of things I do aren't internet-facing so I'm spared a lot of grief. One day I'll get to terms with selinux... one day...