drxm72811
2018-09-02 15:01
浏览 152
已采纳

无法使用Symfony 4.1创建数据库:找不到驱动程序

When i do the command php bin/console doctrine:database:create i have these errors :

In AbstractMySQLDriver.php line 126: An exception occurred in driver: could not find driver

In PDOConnection.php line 50: could not find driver

In PDOConnection.php line 46: could not find driver


config/packages/doctrine.yaml

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

.env

DATABASE_URL=mysql://root:root@127.0.0.1:3306/blogMyProject

My PHP Extensions: My PHP Extensions

php.ini extensions: php.ini extensions

PHP 7.2.7 - MySQL 5.7.11 - Symfony 4.1.4 - I use UwAmp 3.1.0 - I'm on Windows

I don't understand where these errors come from.

图片转代码服务由CSDN问答提供 功能建议

当我执行命令 php bin / console doctrine:database:create 我有这些 错误:

在AbstractMySQLDriver.php第126行: 驱动程序中发生异常:找不到驱动程序

在PDOConnection中 .php第50行:找不到驱动程序

在PDOConnection.php第46行:找不到驱动程序


config / packages / doctrine.yaml

  doctrine:
dbal:
#为数据库服务器配置这些
驱动程序:'pdo_mysql'
 server_version  :'5.7'
 charset:utf8mb4 
 default_table_options:
 charset:utf8mb4 
 collat​​e:utf8mb4_unicode_ci 
   
 
 

.env

  DATABASE_URL = mysql:// root:root@127.0.0.1:3306 / blogMyProject 
   
 
 

我的PHP扩展:

php.ini扩展名:

PHP 7.2.7 - MySQL 5.7.11 - Symfony 4.1.4 - 我使用 UwAmp 3.1.0 - 我在Windows上

我不喜欢 不明白这些错误来自哪里。

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • douhui8025 2018-09-02 16:15
    已采纳

    RiggsFolly brought the solution :

    I have a second php.ini file in UwAmp. The extension pdo_mysql was disabled in bin/php/php-version/php.ini

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dongyuanguang3893 2019-02-14 22:41

    I have just installed UwAmp 3.1.0 on a Windows 10 machine, and faced this same issue when trying to run the php artisan migrate command on a Laravel app. Here's how I solved it:

    • Go to bin/php/<php-version>
    • Make a copy of php_uwamp.ini named php-cli.ini
    • Open it on a text editor
    • Replace extension_dir = "{PHPEXTPATH}" by extension_dir = "ext"
    • Replace zend_extension = "{PHPZENDPATH}/php_xdebug.dll" by extension_dir = "../zend_ext/php_xdebug.dll"

    Every time you change PHP Config on UwAmp interface, you must repeat these steps, since the changes are stored on php_uwamp.ini.

    评论
    解决 无用
    打赏 举报
  • dtx6087 2019-03-12 10:15

    This works for my case

    symfony 4.2
    php 7.3
    

    I enabled

    extension=pdo_mysql
    

    in php.ini

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题