简体   繁体   中英

laravel.log permission denied error

I am working on Laravel 4. On remote server I took backup of old laravel.log and created new one and restored old one again by removing newly created one. Since then I am getting error:

Error in exception handler: The stream or file "/var/www/stage/webapp/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/staging_html/webapp/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:84

I even change mode and but it did not work either. It's not happening across system, just a particular page.

I am on Amazon AWS

You recreated the file, so the permissions have changed, and apache can no longer access it. Run this in command line to set the permissions:

chown www-data:www-data /var/www/stage/webapp/app/storage/logs/laravel.log

That's if you're using apache. It changes ownership of the file to apache (web server). If the web server user isn't www-data. Find out by typing:

ls -l

In the command line to see what user owns the other files in your laravel directory. Replace www-data:www-data with the user that owns the other web files. To be clear the left side of the colon is user group and the right side is the user. If you have a specific user group that needs access to those files as well like git or ftp, you may need to set it like this:

git:www-data
ftp:www-data
group:user //generic example

It just depends on your access requirements. If you have questions let me know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM