Skip to content
Advertisement

Laravel keep chmod storage folder

When i access view in my laravel application, why is it always showed this error every 1 minute:

file_put_contents(/home/vagrant/Code/myproject/storage/framework/cache/data/db/59/db59a863cb50aaccca0c973c049bd67971a7e3ae): failed to open stream: Permission denied ?

When i run chmod -R 777 storage/, that’ll work, but then it keep changing permission every 1 minute.

Even though I do:

  • php artisan config:cache
  • php artisan cache:clear
  • php artisan view:clear
  • php artisan clear-compiled

in my local machine, didn’t work for me.

I’m using:

  • Mac OS High Sierra 10.13.3
  • Vagrant 2.0.2 (ubuntu18.04)
  • Laravel 5.5
  • PHP 7.2

Please help. Thank you for any answer.

Advertisement

Answer

Change the owner of the whole project with chown. Set the new owner www-data.

sudo chown -R www-data:www-data /var/www

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement