Laravel 5.7 and common issues
Author
Author

Robert Nicjoo [68]

I love Laravel & WordPress, interested to pass little knowledge that I have to others.

Qr-Code

Scan to visit on mobile

TJD STUDIO is Hiring

Photographer & Videographer

Apply now Jabodetabek

Laravel 5.7 and common issues

Laravel is awesome php framework no doubt on that, but like any other frameworks it has bugs and issues and that's exactly why it get updates.

Today I will point to two common issues in laravel and how to solve them (if you have other issues and solutions comment it below and i'll update this post)

 

1. Failed to clear cache. Make sure you have the appropriate permissions.

This error happens when you try to run php artisan cach:clear or php artisan cache:clear .

 

Solution:

create data folder in storage/framework/cache

full address storage/framework/cache/data .

 

2.  

SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = root and table_name = migrations)

This happens when you try to run php artisan migrate command.

 

Solution:

1. clear config caches php artisan cach:clear (if doesn't work use no.2)

2. delete cache files from bootstrap/cache folder (if doesn't work use no.3)

3. restart your server

Note: Must of the times it is not really issue with your caching or database even laravel, it's simply you to make mistake in providing database information in .env file.

Example:

#wrong
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=root
DB_USERNAME=blog
DB_PASSWORD=

# Correct
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=

must of the times this error caused because we provide database_user and database_name wrong. (I suggest you double check your .env file before moving forward).

 

If you have any other issues and the solution share with us in comments below and I'll update this list.

How do you like this article?

Back to top