2

I'm pretty new at laravel,Actually when i create this command php artisan migration so i face this error how can i resolve this issue thanks.

Error

UnexpectedValueException : The stream or file "/home/zubair/htdocs/project/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

Jignesh Joisar
  • 13,720
  • 5
  • 57
  • 57
Zubair
  • 295
  • 4
  • 17
  • How did you serve your Laravel app? Laravel built-in server? Nginx? Apache? or something else – amirmodi Feb 08 '20 at 06:13
  • I am using Apache server on linux os. – Zubair Feb 08 '20 at 06:14
  • I think the problem is the apache is using `www-data` user and you are using your own user. You need to change the user that apache is using to serve the app in apache configurations to be the same as the user you are running a command with. – amirmodi Feb 08 '20 at 06:18
  • It's duplicate of [this](https://stackoverflow.com/a/45673457/10990444) . This answer will help you – nika Feb 09 '20 at 08:27

2 Answers2

0

If you run the command with sudo or chmod -R 755 some of the project's folders, you'll have it working.

sudo chmod -R 755 storage bootstrap/cache

Changing entire project folder's permission is probably not a good idea as your project becomes accessible to any user/script which kind of defeats the purpose of securing it behind root.

Qumber
  • 13,130
  • 4
  • 18
  • 33
0

change a permission of storage folder

sudo chmod -R 775 /var/www/html/your-project/storage

for more info check this link install laravel in apache

Jignesh Joisar
  • 13,720
  • 5
  • 57
  • 57