3
votes

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?

3
which means that you need to 755 permission to strorage directory(Recursively) - Manojkiran.A

3 Answers

8
votes

First Clear your Cache,

php artisan config:clear
php artisan config:cache

And Then Run sudo chmod -R 777 storage/

Alternatively you can delete your bootstrap/cache/config.php

3
votes

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 !

0
votes

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

/var/www/html/snipeit/storage/framework# chown -R snipeitapp:www-data cache/