'Symfony 5.1 make:migration error "could not find driver"

When I try to make a php bin/console make:migration
I have this return :


  An exception occurred in driver: could not find driver  


In Exception.php line 18:

  could not find driver  


In PDOConnection.php line 37:

  could not find driver  

I'm using internal server with server:run I'm using PHP 7.4.11 and

php -v give me the good version php 7.4.11

My file doctrine.yaml have :

doctrine:
    dbal:
    # configure these for your database server
        driver: 'pdo_mysql'
        server_version: '5.7'
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci
        url: '%env(resolve:DATABASE_URL)%'

and my .env have :

# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://root:@127.0.0.1:3306/blog?serverVersion=5.7

My EXTENSIONS=pdo_mysql is active...



Solution 1:[1]

It may be late for you, but hopefully this answer will help someone else with the same problem. well all you need to do is to add a file of environment variables locally using this composer command: composer dump-env dev then it will create a file .env.local.php the final step is to configure the database url with your personal info. An example: 'DATABASE_URL' => 'yourSGBD://username:[email protected]:5432/appName?serverVersion=13&charset=utf8'.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fatima Zahra Ben hammou