file_put_contents(meta/services.json): failed to open stream: Permission denied
Suggestion from vsmoraes worked for me:
Laravel >= 5.4
php artisan cache:clear chmod -R 775 storage/composer dump-autoload
Laravel < 5.4
php artisan cache:clear chmod -R 775 app/storage composer dump-autoload
NOTE: DO NOT DO THIS ON ANY REMOTE SERVER (DEV OR PRODUCTION)
When I asked this question, this was a problem on my localhost, running in a Virtual Machine. So I thought setting up a 777 was safe enough, however, folks are right when they say you should look for a different solution. Try 775 first
For googlers who has been facing this problem with Laravel 5.
This is a permission issue caused by different users trying to write at the same log file within the storage/logs
folder with different permissions.
What happens is your laravel config probably is setup to log errors daily and therefore your webserver (apache/nginx) might create this file under a default user depending on your environment it can be something like _www
on OSX or www-data
on *NIX systems, then the issue comes when you might have run some artisan commands and got some errors, so the artisan will write this file but with a different user because PHP on terminal is executed by a different user actually your login user, you can check it out by running this command:
php -i | grep USER
If your login user created that log file your webserver you will not be able to write errors in it and vice-versa because laravel writes log files with 655
permissions by default which only allows the owner to write in it.
To fix this temporary you have to manually give permissions for the group 664
to this file so both your login user and webserver user can write to that log file.
To avoid this issue permanently you may want to setup a proper permissions when a new file is create within the storage/logs
dir by inheriting the permissions from the directory this answer https://unix.stackexchange.com/a/115632 can help you to tackle with that.