Driver not found - "An exception occurred in driver: could not find driver" in Symfony 5
<p>I am currently facing this problem. I'm a real newbie when it comes to Symfony. </p>
<p>Question:
When I create a new database using cli <code>symfony console doctrine:database:create</code>, I get the following error: </p>
<pre class="brush:php;toolbar:false;">In AbstractPostgreSQLDriver.php line 102:
An exception occurred in driver: could not find driver
In Exception.php line 18:
could not find driver
In PDOConnection.php line 38:
could not find driver</pre>
<p>I am using php 7.4 with xampp, normally pdo_sql is installed: </p>
<pre class="brush:php;toolbar:false;">extension=bz2
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop</pre>
<p>This is my .env file configuration: </p>
<pre class="brush:php;toolbar:false;">###> doctrine/doctrine-bundle ###
# For the format, see https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You must configure your server version here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
DATABASE_URL="mysql://root:@127.0.0.1:3306/dbname"
DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###</pre>
<p>This is my doctrine.yaml file configuration: </p>
<pre class="brush:php;toolbar:false;">doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You must configure your server version here or in the DATABASE_URL environment variable (see .env file)
#server_version: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'AppEntity'
alias: App</pre>
<p>I've been searching for hours but can't find any solution to my problem, does anyone have an idea?
I'm using a Windows system.</p>
<p>Thank you very much! </p>