PDOException “could not find driver” in php

brew install php70-pdo-pgsql in case you installed php7 on mac with brew and, change php version according to what you have installed.


In Ubuntu, write in the console

sudo apt-get install php5-gd php5-mysql

and it will work


You need to have a module called pdo_mysql.

Look for the following in phpinfo() output,

pdo_mysql => PDO Driver for MySQL, client library version => 5.1.44

to install pdo_mysql you need to do this:

 pecl install pdo
 pecl install pdo_mysql

and then add the following to your php.ini file:

extension=pdo.so
extension=pdo_mysql.so

Hope you are running your project in localhost. In your project folder app/config a file named parameters.ini , Make sure that your Mysql database connection cofiguration is correct. If you are using mysql See database_driver=pdo_mysql is its driver.

Below is an example.

database_driver   = pdo_mysql
    database_host     = localhost
    database_port     =
    database_name     = databasename
    database_user     = msqlusername
    database_password = mysqlpassword//if not make blank

    mailer_transport  = smtp
    mailer_host       = localhost
    mailer_user       =
    mailer_password   =

    locale            = en

    secret            = ThisTokenIsNotSoSecretChangeIt

Hope it helps you.

Tags:

Mysql

Php

Symfony