How to fix Error: laravel.log could not be opened?
To fix this issue, you need to change the ownership of the directory to the unix user that the webserver uses.
- Get out of the VM
- Using the console, go to your synced folder (vagrant)
- sudo chown -R $USER:www-data storage
- chmod -R 775 storage
Even though I created the project within the VM using the VM user, the folder belonged to the user in the real computer; so, when trying to
Now it's working.
Thanks to all those that helped me figure this thing out
EDIT:
Actually, it still wasn't working, it still gave me a "permission denied" problem.
Here's what I did, I modified my Vagrantfile like this:
config.vm.synced_folder "./app","/var/www/", create:true,
:owner => "vagrant",
:group => "www-data",
:mount_options => ["dmode=775","fmode=664"]
laravel.log could not be opened: failed to open stream
You need to run one of the following:
sudo chmod -R 644 app/storage
sudo chmod -R 755 app/storage
How to fix Error: laravel.log could not be opened Permission denied?
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.
storage/logs/laravel-2019-11-22.log could not be opened: failed to open stream: Permission denied
Alright I got the answer:
AWS AMI uses webapp
as the web user, not apache or ec2-user
as the file shows. In that case, the webapp
user has no access rights over those files.
sudo chown $USER:webapp ./storage -R
find ./storage -type d -exec chmod 775 {} \;
find ./storage -type f -exec chmod 664 {} \;
Laravel with Docker laravel.log could not be opened in append mode: Failed to open stream: Permission denied
Answer:
chown -R www-data storage
- Make www-data the owner.
The stream or file /app/storage/logs/laravel.log could not be opened: failed to open stream:Permission denied
Google Cloud is a write only filesystem. For directories which need to be written into by the application, you will need to make some modifications.
Please see https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard and make note of steps 1 and 3 under the deploy section, which set the APP_STORAGE
path to /tmp so that it will be writable.
Related Topics
"Connect Failed: Access Denied For User 'Root'@'Localhost' (Using Password: Yes)" from PHP Function
Get the Last Inserted Id Using Laravel Eloquent
Using a .PHP File to Generate a MySQL Dump
Isset() and Empty() - What to Use
Storing Files in Database VS File System
Where Does PHP'S Error Log Reside in Xampp
Can Png Image Transparency Be Preserved When Using PHP'S Gdlib Imagecopyresampled
Get PHP to Stop Replacing '.' Characters in $_Get or $_Post Arrays
Deny Direct Access to a Folder and File by Htaccess
How to Replace Microsoft-Encoded Quotes in PHP
How to Delete a Line from the File With PHP
Change Cart Item Prices in Woocommerce 3