amiega
amiega

Reputation: 27

How can i solve an error "pdo exception could not find the driver" on laravel migration?

I am studying laravel framework by myself and am trying to build simple blog with it. However, I found an error when i migrate the tables to the database(I am using mysql). When i run the command- php artisan migrate - on ubuntu 14.04, i got these message

[Illuminate\Database\QueryException]                                         
could not find driver (SQL: select * from information_schema.tables 
where table_schema = laravel-blog and table_name = migrations)

and

[PDOException]         
could not find driver

I tried the last two days to find the answer on youtube, google, here in stackoverflow,etc.; but i can't.

So someone has a skill on laravel, please help me. Thanks

Upvotes: 0

Views: 1487

Answers (2)

Dang Cong Duong
Dang Cong Duong

Reputation: 506

Open php.ini file and enable extension=pdo_mysql

Upvotes: 0

He Hui
He Hui

Reputation: 2236

I just ran into a similar problem (again).

Just in case this helps people, you need the following packages for PHP on Laravel 5.5 (I use yum, but feel free to change use apt-get if thats what you prefer).

php71.x86_64                         7.1.7-1.26.amzn1              @amzn-updates
php71-cli.x86_64                     7.1.7-1.26.amzn1              @amzn-updates
php71-common.x86_64                  7.1.7-1.26.amzn1              @amzn-updates
php71-json.x86_64                    7.1.7-1.26.amzn1              @amzn-updates
php71-mbstring.x86_64                7.1.7-1.26.amzn1              @amzn-updates
php71-mysqlnd.x86_64                 7.1.7-1.26.amzn1              @amzn-updates
php71-pdo.x86_64                     7.1.7-1.26.amzn1              @amzn-updates
php71-process.x86_64                 7.1.7-1.26.amzn1              @amzn-updates
php71-xml.x86_64                     7.1.7-1.26.amzn1              @amzn-updates

The way to check this is yum list installed | grep php. The package I was missing was php71-mysqlnd

Upvotes: 1

Related Questions