Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel The stream or file "storage/laravel.log" could not be opened in append mode: failed to open stream: Permission denied in RHEL8

Tags:

laravel

rhel8

I need help here. I installed Laravel in my RHEL 8 Server

But I'm getting this error. I know this question already posted many times but I tried to follow the suggestion but no luck for me so far. I have no idea why.

The stream or file "/var/www/html/vpa/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

enter image description here I tried to use this command to change the permission but it didn't work .

sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache 
sudo chmod -R 755 storage
sudo chmod -R 755 bootstrap/cache

sudo setenforce 0 
sudo chcon -t httpd_sys_rw_content_t storage

php artisan config:clear
php artisan config:cache
composer dump-autoload

sudo systemctl restart httpd
sudo reboot 

Nothing seems to work on my side . I don't know what else to do. Please help me

like image 575
Rzj Hayabusa Avatar asked Oct 27 '20 09:10

Rzj Hayabusa


2 Answers

on ubuntu this step solved it

php artisan config:clear

php artisan cache:clear

sudo chmod -R 775 /var/www/your_folder

sudo chown -R www-data:www-data var/www/your_folder 
like image 118
Ossim Julius Avatar answered Sep 28 '22 08:09

Ossim Julius


sudo chmod +w storage/logs/laravel.log

Never use 777

Those are irresponsible permissions

like image 23
Neftalí Yagua Avatar answered Sep 28 '22 08:09

Neftalí Yagua