Question

I have installed Lampp on my linux system, and I am learning symfony2, while trying to create the schema with symfony2 command

php app/console doctrine:schema:create

I am getting the following error message:-

PDOException “could not find driver”

I also uncomment this line extension=php_pdo_mysql.dll in php.ini file

I tried to look and google my issue but couldn't resolve my problem. when i run php -m command i am getting the following result:-

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
----
----

Is there a way i can remove this issue ?

Was it helpful?

Solution

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.

OTHER TIPS

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

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

There are two PHP versions installed in my server PHP 5.6 and PHP 7

When I run the command php app/console doctrine:schema:update I have the error : [PDOException] could not find driver

I resolve this error by specifying the PHP version:

php5.6 app/console doctrine:schema:update

Looks like your install is missing the .so files it needs to implement the mysql connection. If you're using a package management system to install PHP then make sure you've installed all the necessary submodules (in this case I think you'll need mysql-dev, and the various PHP PDO modules), though such dependencies should have been resolved for you by the package manager.

If you didn't go through a package manager, then you'll have to compile the required .so files from source.

if you are using XAMPP then in php.ini file line no 897(depends on version),

;extension=php_pdo_pgsql.dll 

uncomment it , then it appears like below

extension=php_pdo_pgsql.dll 

in php.ini file line no 897, then restart XAMPP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top