Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4: Failed to open stream: Permission denied

I'm having problem in setting up Laravel 4. I'm having this error when opening the index page:

file_put_contents(/Users/laravel/app/storage/meta/services.json) [function.file-put-contents]:
failed to open stream: Permission denied.

What am I missing here?

like image 627
Bryan P Avatar asked Jun 10 '13 09:06

Bryan P


1 Answers

I think chmod -777 is a bad practice.

To solve permissions issue on Laravel, I've done this (with root user):

cd app/

chown -R www-data:www-data storage

cd storage/

find . -type d -exec chmod 775 {} \; && find . -type f -exec chmod 664 {} \;

And always in app/storage directory :

chown your_user:user_group .gitignore cache/.gitignore logs/.gitignore meta/.gitignore sessions/.gitignore views/.gitignore

Now, exit the root user, and it's ok.

EDIT : this was for Laravel4. This doesn't works for Laravel5 because of a different structure.

like image 103
François Avatar answered Sep 30 '22 09:09

François