简体   繁体   中英

An exception occured in driver: could not find driver tying to create database on doctrine

I've executed

 php bin/console doctrine:database:create

to create the project's datbabase andI get this error

Failed loading /opt/lampp/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so:  /opt/lampp/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so: cannot open shared object file: No such file or directory

In AbstractMySQLDriver.php line 115:

  An exception occured in driver: could not find driver  


In PDOConnection.php line 47:

  could not find driver  


In PDOConnection.php line 43:

  could not find driver  

I'm using xampp on ubuntu and this is the config file of symfony

 # This file is auto-generated during the composer install
parameters:
    database_host: 127.0.0.1
    database_port: 3306
    database_name: mydb
    database_user: root
    database_password: 12345
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    secret: 55c7fcc15002180af1c4f7ad79dc62cfe6dfd91e

I'dont know what is wrong

I think the driver is not configured in your parameter, so let's add it like :

 parameters: database_driver: pdo_mysql # <== you can change it in your driver database database_host: 127.0.0.1 database_port: 3306 database_name: mydb database_user: root database_password: 12345 mailer_transport: smtp mailer_host: 127.0.0.1 mailer_user: null mailer_password: null secret: 55c7fcc15002180af1c4f7ad79dc62cfe6dfd91e 

NB: you can check all driver available in your terminal like this:

 php -m 

and normally it must display you the extension driver you need like :

 ....... PDO pdo_dblib pdo_mysql PDO_ODBC pdo_pgsql pdo_sqlite pgsql ....... 

thanks, I hope it's help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM