本文介绍了PDOException“找不到驱动程序"在PHP中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have installed Lampp on my linux system, and I am learning symfony2, while trying to create the schema with symfony2 command

php app/console doctrine:schema:create

我收到以下错误消息:-

I am getting the following error message:-

PDOException "could not find driver"

我还取消了php.ini文件中此行extension=php_pdo_mysql.dll的注释

I also uncomment this line extension=php_pdo_mysql.dll in php.ini file

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

I tried to look and google my issue but couldn't resolve my problem. when i run php -m command i am getting the following result:-

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
----
----

有没有一种方法可以消除此问题?

Is there a way i can remove this issue ?

推荐答案

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

Hope you are running your project in localhost. In your project folder app/config a file named parameters.ini , Make sure that your Mysql database connection cofiguration is correct. If you are using mysql See database_driver=pdo_mysql is its driver.

下面是一个例子.

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

希望它对您有帮助.

这篇关于PDOException“找不到驱动程序"在PHP中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 03:35