PDOException 找不到驱动程序 [英] PDOException could not find driver
问题描述
我正在使用 symfony,当我在控制台中输入:
php 应用程序/控制台原则:架构:创建
我有下一个错误
[Doctrine\DBAL\Exception\DriverException]
驱动程序发生异常:找不到驱动程序
[Doctrine\DBAL\Driver\PDOException]
找不到驱动
[PDO异常]
找不到驱动
我一直在关注这个链接以整理它
这是我运行 php -m 时得到的
root@asus-K53SD:/opt/lampp/htdocs/symfonycurso# php -m
<块引用><前>root@asus-K53SD:/opt/lampp/htdocs/symfonycurso# php -m[PHP 模块]日历核类型日期domexif档案信息筛选FTP获取文本散列图标json库文件opensslpcntl聚氯乙烯PDOpdo_sqlite法尔posix阅读线反射会议擦洗简单XML插座声压级sqlite3标准系统消息系统信息系统虚拟机分词器世界末日xml阅读器编写器xslZend OPcachezlibZend 模块Zend OPcache我取消注释并重新启动服务器
扩展名=php_pdo_pgsql.dll
这是我的参数.yml
<块引用>添加了 database_driver : pdo_mysql 和密码删除(之前为空)
# 这个文件是在 composer 安装过程中自动生成的参数:数据库驱动程序:pdo_mysql数据库主机:127.0.0.1数据库端口:数据库名称:博客数据库用户:root数据库密码:mailer_transport:smtp邮件主机:127.0.0.1邮件用户:邮件密码:秘密:ThisTokenIsNotSoSecretChangeIt
有谁知道我该如何解决这个错误??可能是我在 PHP7 上工作的问题
注意:在 linux 上使用 lampp
使用 LAMP 您不需要在 .ini 文件中启用 php_pdo_mysql.dll.相反,在 cli 中运行以下命令,
sudo apt-get install php7.0-mysql
(使用您使用的特定 PHP 版本).
现在你可以通过运行 php -m
命令看到 pdo_mysql
模块.
然后,您清除 symfony 中的缓存并运行 symfony 命令.
im working with symfony and when i type in console this:
php app/console doctrine:schema:create
i have the next errors
[Doctrine\DBAL\Exception\DriverException]
An exception occured in driver: could not find driver
[Doctrine\DBAL\Driver\PDOException]
could not find driver
[PDOException]
could not find driver
I've been following this link in order to sort it out
PDOException "could not find driver" in php
this is what i get when i run php -m
root@asus-K53SD:/opt/lampp/htdocs/symfonycurso# php -m
root@asus-K53SD:/opt/lampp/htdocs/symfonycurso# php -m [PHP Modules] calendar Core ctype date dom exif fileinfo filter ftp gettext hash iconv json libxml openssl pcntl pcre PDO pdo_sqlite Phar posix readline Reflection session shmop SimpleXML sockets SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter xsl Zend OPcache zlib Zend Modules Zend OPcache
i uncommented this and restart the server
extension=php_pdo_pgsql.dll
this is my parameter.yml
Added database_driver : pdo_mysql and password removed (before was null)
# This file is auto-generated during the composer install parameters: database_driver : pdo_mysql database_host: 127.0.0.1 database_port: database_name: blog database_user: root database_password: mailer_transport: smtp mailer_host: 127.0.0.1 mailer_user: mailer_password: secret: ThisTokenIsNotSoSecretChangeIt
anyone know how can i fix this errors?? can be the problem that im working on PHP7
NOTE: Using lampp on linux
Using LAMP you don't need to enable php_pdo_mysql.dll in the .ini file. Instead, run this below command in cli,
sudo apt-get install php7.0-mysql
(Use specific PHP version which you used).
Now you can see pdo_mysql
module by running php -m
command.
Then, you clear the cache in symfony and run the symfony commands.
这篇关于PDOException 找不到驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!