Jaime Dolor jr.
Jaime Dolor jr.

Reputation: 919

How do I fix laravel.log cannot be opened in AWS deploy?

We have a Laravel app (version 4) that we're trying to deploy on AWS. Previously, it was hosted in our local servers via XAMPP. On AWS, I created a folder for the laravel app in var/www/html directory path. But as I try to access http://aws-url/laravel_folder/public, I get the error message:

Error in exception handler: The stream or file "/var/www/html/laravel_folder/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/laravel_folder/bootstrap/compiled.php:9134

I've checkout all similar questions and have followed the suggestions, i.e. setting permission of laravel.log to 777, but still keep getting the same problem.

How do I fix this problem?

Thank you

Upvotes: 0

Views: 767

Answers (2)

sevynos
sevynos

Reputation: 57

First 777 permission is not a good idea.

If you're on linux, use the following command:

chmod -R 770 logs (add sudo in front if you're not the owner of the folder!)

That will give owner and group read-write-execute permission on the logs folder and everything inside it but will give no permission to other users.

Also make sure that the folder and files inside it have the web server's user as group.

Hope that's help!

Upvotes: 1

Rob Fonseca
Rob Fonseca

Reputation: 3819

You need to set the permissions for the entire storage folder to 777

sudo chmod -R 777 storage/

Upvotes: 0

Related Questions