I am new to Laravel. I was trying to open http://localhost/test/public/
and I got
Error in exception handler.
I googled around and changed the permission of storage directory using chmod -R 777 app/storage
but to no avail.
I changed debug=>true
in app.php
and visited the page and got Error in exception handler:
The stream or file "/var/www/html/test/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/test/bootstrap/compiled.php:8423
Then I changed the permissions of storage directory using the command chmod -R 644 app/storage
and the 'Error in exception handler' error was gone and a page is loaded. But in there I am getting this:
file_put_contents(/var/www/html/laravel/app/storage/meta/services.json): failed to open stream: Permission denied
FOR ANYONE RUNNING AN OS WITH SELINUX: The correct way of allowing httpd to write to the laravel storage folder is:
Then to apply the changes immediately:
SELinux can be a pain to deal with, but if it's present then I'd STRONGLY ADVISE you learn it rather than bypassing it entirely.
Xampp for use:
some times SELINUX caused this problem; you can disable selinux with this command.
I have the same issue when running vagrant on mac. solved the problem by changing the user of Apache server in https.conf file:
Run apache under php user instead of user daemon to resolve file access issue with php
now, php created cache file can be read and edit by apache without showing any access permission error.
Suggest the correct permission, if for Apache,
Any time I change app.php I get a permission denied writing bootstrap/cache/services.json so I did this to fix it: