小编典典

PDOException“找不到驱动程序”在PHP

mysql

我已经在Linux系统上安装了Lampp,并且在尝试使用symfony2命令创建架构时正在学习symfony2。

php app/console doctrine:schema:create

我收到以下错误消息:

PDOException “could not find driver”

我也在extension=php_pdo_mysql.dllphp.ini文件中取消注释此行

我试图查看并用Google搜索我的问题,但无法解决我的问题。当我运行php -m命令时,我得到以下结果:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
----
----

有什么办法可以消除此问题?


阅读 288

收藏
2020-05-17

共1个答案

小编典典

希望您正在本地主机中运行项目。在项目文件夹app /
config中,一个名为parameters.ini的文件,请确保您的Mysql数据库连接配置正确。如果使用的是mysql,请参database_driver=pdo_mysql见其驱动程序。

下面是一个例子。

database_driver   = pdo_mysql
    database_host     = localhost
    database_port     =
    database_name     = databasename
    database_user     = msqlusername
    database_password = mysqlpassword//if not make blank

    mailer_transport  = smtp
    mailer_host       = localhost
    mailer_user       =
    mailer_password   =

    locale            = en

    secret            = ThisTokenIsNotSoSecretChangeIt

希望对您有帮助。

2020-05-17