May 13, 2018

Laravel error: permission denied

I setup a virtual machine for development on my pc with PuPHPet and when I setup Laravel I got the following error when I tired to access the site in my browser

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

I looked this error up online and all I had to do was change the pemissions on that folder with

chmod -R 775 storage

and also changed the group to the webserver user

chown -R root:www-data storage

but notting seemed to work at all, what I noticed was none of the commands make any changes at all, the way to change file permissions is to open up your home PuPHPet folder and there is a file there called Vagrantfile.

and before the word end in the file add the following and change put the location of your storage folder in laravel.

config.vm.synced_folder “./testproject/storage”, “/var/www/testproject/storage”,

mount_options: [“dmode=775,fmode=775”]

now restart your virtual machine and it should now work.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket