1

My application is being deployed to AWS Lightsail(LAMP) and when I try to run artisan migrate it says:

The stream or file "/opt/bitnami/projects/app-name/storage/logs/laravel.log" could not be opened in append mode: failed to o
pen stream: Permission denied

What I have tried so far is to allow access to storage via:

sudo chmod -R 775 storage

Also, I can only access my home page if I use sudo chmod -R 777 storage but not sudo chmod -R 775 storage. I am not sure why.

but it is still giving me the error. What seems to be this issue?

  • 1
    `sudo chmod -R ugo+rw storage` – JEJ Jul 27 '21 at 09:13
  • @JEJ I cannot access my server if I use 775. –  Jul 27 '21 at 09:15
  • HINT::its not just about the number, it's about ownership The first digit represents what the owner of the files can do The second digit is what members of the same group can do The third digit is what anyone can do – JEJ Jul 27 '21 at 09:22
  • https://stackoverflow.com/q/30639174/15648920 this may help you – JEJ Jul 27 '21 at 09:25
  • Doesn't your command make it ```777```? –  Jul 27 '21 at 09:25
  • Does this answer your question? [Laravel The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied](https://stackoverflow.com/questions/48506193/laravel-the-stream-or-file-storage-logs-laravel-log-could-not-be-opened-fail) – Rakesh kumar Oad Jul 27 '21 at 11:25
  • sudo chgrp -R www-data storage bootstrap/cache sudo chmod -R ug+rwx storage bootstrap/cache – Rakesh kumar Oad Jul 27 '21 at 13:06

1 Answers1

4

This commands were helpful:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

also follow this link

Rakesh kumar Oad
  • 1,332
  • 1
  • 15
  • 24