错误在symfony 4中创建数据库?

时间:2018-05-27 19:08:33

标签: symfony

sudo php bin/console doctrine:database:create

In AbstractMySQLDriver.php line 125:

  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


doctrine:database:create [--shard SHARD] [--connection [CONNECTION]] [--if-not-exists] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

请帮忙。

2 个答案:

答案 0 :(得分:0)

您必须启用PDO扩展名。

如果您使用的是Windows计算机,请查看php.ini文件并取消注释extension=php_pdo_mysql.dll。您可以通过查看php.ini找到phpinfo()文件的路径。

于Debian / Ubuntu

PHP 5 sudo apt-get install php5-mysql

PHP 7 sudo apt-get install php7.0-mysql

然后,您需要确保模块已启用:

sudo phpenmod pdo_mysql

然后重启Apache:

sudo service apache2 restart 

答案 1 :(得分:0)

检查您的php.ini文件是否包含以下行:

extension=pdo_mysql
extension=pdo_pgsql
extension=mysqli