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

问题描述

我已经在我的 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

希望对你有帮助.

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

08-11 03:35