Posts Learn Components new Snippets new Categories Tags About
/

How to Fix Laravel "Log Could Not be Opened " Error?

Learn how to fix Laravel folder permission to prevent "Laravel Log Could Not be Opened" error

Created on Oct 14, 2021

•

22 views

You might have come across an issue of " Laravel Log Could Not be Opened" and the main reason for this error is because of the folder permission which generally does not allow Laravel to write logs to the local folder. In this short snippet, you will learn some of the possible ways to fix this error.

Enter Into The Laravel Project


The first thing that you have to do is to change the directory to the Laravel project and you can do that using the "cd" command like below.
cd /path/to/your-laravel-project

Method 1: Change Directory Permission


Once you have entered the root directory now you can change the directory permission using the "chmod" command. For the code example below you can pass in the "-R" flag to make it recursive which means all subdirectories will have the same permission.
sudo chmod -R 755 storage/
sudo chmod -R 755 bootstrap/cache/
Do note that the "755" is the directory permission and below are the details of each of the numbers.
7 - Owner can write
7 - Group can write
5 - Others cannot write!

Method 2: Make use of the "clear" Command


Another possible way to fix this error is to make use of the "clear" command. These commands will clear the route, config as well as the cache.
php artisan route:clear
php artisan config:clear
php artisan cache:clear
new

If you like our tutorial, do make sure to support us with some coffee. We need the juice to write the content during the night 🤙🏻