我正在使用 symfony,当我在控制台中输入以下内容时:
php app/console doctrine:schema:create
我有接下来的错误
[学说\DBAL\异常\DriverException]
驱动程序出现异常:找不到驱动程序
[学说\DBAL\驱动程序\PDOException]
找不到驱动程序
[PDO异常]
找不到驱动程序
我一直在关注这个链接来解决这个问题
php 中的 PDOException“找不到驱动程序” https://stackoverflow.com/questions/9308147/pdoexception-could-not-find-driver-in-php
这就是我跑步时得到的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
xmlr eader
xmlwriter
xsl
Zend OPcache
zlib
Zend Modules
Zend OPcache
我取消注释并重新启动服务器
扩展名=php_pdo_pgsql.dll
这是我的parameter.yml
添加了database_driver:删除了pdo_mysql和密码(之前为空)
# 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
有人知道我该如何修复这个错误吗?可能是我在 PHP7 上工作的问题
注意:在 Linux 上使用 lampp
Using LAMP您不需要在 .ini 文件中启用 php_pdo_mysql.dll。
相反,在 cli 中运行以下命令,
sudo apt-get install php7.0-mysql
(使用您使用的特定 PHP 版本)。
现在你可以看到pdo_mysql
模块通过运行php -m
命令。
然后,清除 symfony 中的缓存并运行 symfony 命令。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)