2
votes

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

2
How did you serve your Laravel app? Laravel built-in server? Nginx? Apache? or something elseamirmodi
I am using Apache server on linux os.Zubair
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
It's duplicate of this . This answer will help younika

2 Answers

0
votes

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.

0
votes

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