Home  >  Q&A  >  body text

PDOException "Driver not found" in php

<p>I have installed Lampp on my linux system and I am learning symfony2 while trying to create schema using symfony2 command</p> <pre class="brush:php;toolbar:false;">php app/console doctrine:schema:create</pre> <p>I received the following error message: -</p> <pre class="brush:php;toolbar:false;">PDOException “could not find driver”</pre> <p>I also uncommented the line <code>extension=php_pdo_mysql.dll</code></p> in the php.ini file <p>I tried finding and searching for my problem but I couldn't solve my problem. When I run the <code>php -m</code> command I get the following result: -</p> <pre class="brush:php;toolbar:false;">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 ---- ----</pre> <p>Is there any way to eliminate this problem? </p>
P粉478445671P粉478445671418 days ago566

reply all(2)I'll reply

  • P粉788571316

    P粉7885713162023-08-30 11:07:20

    In Ubuntu, write

    in the console
    sudo apt-get install php5-gd php5-mysql

    It will work

    reply
    0
  • P粉203792468

    P粉2037924682023-08-30 09:52:16

    Hopefully you are running your project in localhost. There is a file named parameters.ini in your project folder app/config, make sure your Mysql database connection is configured correctly. If you use mysql, see database_driver=pdo_mysql is the driver for it.

    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.

    reply
    0
  • Cancelreply