PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, August 1, 2022

[FIXED] How do I change directory permissions for laravel logs?

 August 01, 2022     console, directory, file-permissions, laravel, vps     No comments   

Issue

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

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



Answered By - Strawberry_cat_guy
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing