Error Failed to open stream Permission denied in Laravel

0 votes

I'm having problem in setting up Laravel. 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?

Apr 3, 2020 in Laravel by kartik
• 37,520 points
16,889 views

2 answers to this question.

0 votes

Hii @kartik,

To solve permissions issue on Laravel, I have 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.

Hope this works!!

Thank You!

answered Apr 3, 2020 by Niroj
• 82,840 points
0 votes
I had this problem lately with my tests, and resolved it through: composer dump-autoload
answered Nov 4, 2020 by anonymous
• 140 points

Related Questions In Laravel

0 votes
2 answers
0 votes
1 answer

The stream or file "/var/www/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

Hello @kartik, Make your Dockerfile something as below ...READ MORE

answered Sep 30, 2020 in Laravel by Niroj
• 82,840 points
21,472 views
0 votes
1 answer

Error:Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory

Hello @kartik, The best way to solve this ...READ MORE

answered Aug 10, 2020 in Laravel by Niroj
• 82,840 points
6,496 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,012 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,994 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,918 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,688 views
+1 vote
3 answers

Error: Exception file_put_contents failed to open stream: No such file or directory in Laravel?

Hello, You should typically run the php artisan config:cache command ...READ MORE

answered Mar 31, 2020 in Laravel by Niroj
• 82,840 points
48,820 views
+1 vote
1 answer

Error:file_put_contents(meta/services.json): failed to open stream: Permission denied?

Hello @kartik, Below steps helped me fix the ...READ MORE

answered Apr 3, 2020 in Laravel by Niroj
• 82,840 points
8,669 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP