I am looking for a more detailed answer from the following resolved issue "The stream or file "laravel.log" could not be opened: failed to open stream: Permission denied"
I am still new to web development and when entering the suggested command (sudo chown -R $USER:www-data storage) in the terminal I get the following error: chown: invalid group: ‘root:www-data’
I have also tried (sudo chown -R www-data:www-data /home/EXAMPLE/EXAMPLE) leading to my project folder but got the following error: chown: invalid user: ‘www-data:www-data’
I am doing this to fix a permissions issue:
The stream or file "/home/EXAMPLEURL/EXAMPLEURL/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied.
I have found the user and group is 'nobody' by using the following commands (find / -name httpd.conf | xargs grep -i "^user") and (find / -name httpd.conf | xargs grep -i "^group").
In the terminal I have tried the following command (sudo chown -R nobody:nobody /home/EXAMPLE/EXAMPLE/storage) in the storage folder, the level above it and the level above that. The terminal returns no error but the permissions error still shows on the live website
Thank you!
Solution, courtesy of a kind soul named Rashedul.
The reason the above solutions didn't work was that previously the owner was nobody. Changing the owner to root allowed the change to take effect
sudo chgrp -R $USER Storage_path