Reputation: 95
I use Laravel 5.4 and got the error at Web Server as below
PHP Fatal error: Uncaught ErrorException: file_put_contents(/github/myweb/monitor/storage/framework/views/b38c71581503e85762ce2fe49a8bis726b1164d9.php): failed to open stream: Permission denied n /github/myweb/monitor/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122\nStack trace:\n#0 [internal function]:
When I tested on local every thing is fine, but after pushing code to server, i am getting error for path '/github/myweb/'
where it's from. I want path like this
/var/www/master/monitor
How to remove prefix '/github/myweb/'
from path I don't know where it's from
What Is wrong?
Upvotes: 8
Views: 40788
Reputation: 41
Clear the cached bootstrap files (events, views, cache, route, config, compiled):
php artisan optimize:clear
Upvotes: 1
Reputation: 479
I'm not sure if what I did is correct but I changed the owner and group of the cache folder to match the rest of the app
# cd /var/www/html/snipeit/storage/framework
# chown -R snipeitapp:www-data cache/
Upvotes: 0
Reputation: 734
First Clear your Cache,
php artisan config:clear
php artisan config:cache
And Then Run sudo chmod -R 755 storage/
Alternatively you can delete your bootstrap/cache/config.php
Upvotes: 13
Reputation: 3083
If you cd into your app, you will probably see that some folders have the "www-data" user or group.
If you are using Laravel Forge, to fix this, you want to change the user and group to "forge".
Instead of cd'ing into every directory and running this on every file and folder, you can do this recursively with the -R flag.
sudo chown -R forge:forge storage
Now you can get back to making progress !
Upvotes: 4