问题
Running Laravel on Homestead gives the following errors:
The stream or file "/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
Now I understand that the permission for storage is not correct but trying the following didn't work:
- Setting file permissions in the guest VM - didn't work
- Changing file permission on the host machine (windows in this case) - didn't work
- Lastly, Adding the following to the Vagrantfile changed the owner of the storage folder but still gives the same error:
config.vm.synced_folder "~/project/storage", "~/project/storage", owner: "www-data", group: "www-data"
I'm not sure what to do next. Any help would be greatly appreciated.
Thank You.
回答1:
For me, I didn't have any permission issues when using Laravel with Homestead; it worked out of the box.
Anyway, SSH into your Vagrant machine, move towards the project's root and run the following commands.
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
来源:https://stackoverflow.com/questions/52276694/vagrant-homestead-storage-folder-permission-denied