Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 - ErrorException failed to open stream: Permission denied

I've just git clone a repository of mine containing a Laravel 5.1 project. I've gone through the normal steps to get it up and running (setup the webserver, db, etc). I've now gone to the web address I configured and i'm getting the following error message:

ErrorException in compiled.php line 6648:
file_put_contents(/3c7922efc24ab13620cd0f35b1fdaa61): failed to open stream: Permission denied

Any idea's what folder it's trying to access?

like image 924
ajtrichards Avatar asked Apr 06 '16 19:04

ajtrichards


2 Answers

I solved the problem with this solution, clarifying that if you have Windows, you apply lines 1 and 3 and it works the same.

php artisan cache:clear
chmod -R 777 storage/
composer dump-autoload
like image 90
Carlos R. Bécquer Rodríguez Avatar answered Nov 07 '22 14:11

Carlos R. Bécquer Rodríguez


To solve this problem I needed to create a few folder's that were missing from my install. You require the following folders to be readable and writable by your www user:

/storage
/storage/cache
/storage/framework
/storage/framework/sessions
/storage/framework/views
/storage/framework/cache
/storage/logs

Also, set the folder permissions to 775. From the root directory run the command: sudo chmod -R 755 storage

like image 23
ajtrichards Avatar answered Nov 07 '22 15:11

ajtrichards