Home / Snippets / How to Fix Laravel "Log Could Not be Opened " Error?
How to Fix Laravel "Log Could Not be Opened " Error? cover

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

147

3 years ago

0 comments

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
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this