php Zend 应用程序未安装 MySql 驱动程序错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1115657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 01:07:45  来源:igfitidea点击:

MySql driver not installed error for Zend application

phpmysqlzend-frameworkpdozend-db

提问by Arc

I am trying to get my ZEND application up on my apache server running on UNIX. Initially my host didnot give PDO support ,and i got it enabled by requesting them with a mail.But now I am getting an error saying The mysql driver is not currently installed

我正在尝试在 UNIX 上运行的 apache 服务器上启动我的 ZEND 应用程序。最初我的主机没有提供 PDO 支持,我通过邮件请求他们启用了它。但现在我收到一个错误,说当前未安装 mysql 驱动程序

The stack trace is like:

堆栈跟踪是这样的:

An error occurred
Application error
Exception information:

Message: The mysql driver is not currently installed
Stack trace:

#0 /home/windchim/worminc/library/Zend/Db/Adapter/Abstract.php(770): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/windchim/worminc/library/Zend/Db/Adapter/Abstract.php(840): Zend_Db_Adapter_Abstract->quote('aaditya258', NULL)
#2 /home/windchim/worminc/library/Zend/Auth/Adapter/DbTable.php(354): Zend_Db_Adapter_Abstract->quoteInto('`password` = MD...', 'aaditya258')
#3 /home/windchim/worminc/library/Zend/Auth/Adapter/DbTable.php(285): Zend_Auth_Adapter_DbTable->_authenticateCreateSelect()
#4 /home/windchim/worminc/library/Zend/Auth.php(117): Zend_Auth_Adapter_DbTable->authenticate()
#5 /home/windchim/worminc/application/controllers/LoginController.php(117): Zend_Auth->authenticate(Object(Zend_Auth_Adapter_DbTable))
#6 /home/windchim/worminc/library/Zend/Controller/Action.php(503): LoginController->processAction()
#7 /home/windchim/worminc/library/Zend/Controller/Dispatcher/Standard.php(285): Zend_Controller_Action->dispatch('processAction')
#8 /home/windchim/worminc/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#9 /home/windchim/public_html/worm/index.php(47): Zend_Controller_Front->dispatch()
#10 {main}

How can this be resolved? Please help

如何解决这个问题?请帮忙

回答by Greg

PDO, unlike the mysql_* functions, supports a number of database engines. To do this it needs a driver library for each one.

与 mysql_* 函数不同,PDO 支持多种数据库引擎。为此,每个驱动程序库都需要一个驱动程序库。

You have the "core" of PDO installed but not the MySQL driver - just get that installed (called pdo_mysql) and everything will be OK.

您已经安装了 PDO 的“核心”,但没有安装 MySQL 驱动程序 - 只需安装它(称为 pdo_mysql),一切都会好起来的。

Your php.ini should have one of these (windows or linux):

你的 php.ini 应该有以下之一(windows 或 linux):

extension=php_pdo_mysql.dll
extension=php_pdo_mysql.so

回答by Azhar Ahammed

In php.ini file u just enable following line extension=php_pdo_mysql.dll (means remove comments in front of it)

在 php.ini 文件中,您只需启用以下行 extension=php_pdo_mysql.dll (意味着删除它前面的注释)

then it will be executed Correctly.

那么它将被正确执行。

回答by djule5

As others have mentionned, you need to enable the pdo_mysql extension.

正如其他人所提到的,您需要启用 pdo_mysql 扩展。

However, running php (5.3) as an apache (2.2) module on my machine (windows 7), it still wouldn't work. I figured out the extension_dir value in php.ini needs to be set using an absolute path(relative just wouldn't work)!

但是,在我的机器(Windows 7)上将 php (5.3) 作为 apache (2.2) 模块运行,它仍然无法正常工作。我发现需要使用绝对路径设置 php.ini 中的 extension_dir 值(相对路径不起作用)!

Hope this helps some of you!

希望这对你们中的一些人有所帮助!

回答by Yaki Dororo

F.i. check spelling of error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT (should be like this at production stage)

Fi 检查 error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT 的拼写(生产阶段应该是这样)

If you type error_reporting (value); or something like this (usually for testing, "value" might be "0")

如果您键入 error_reporting (value); 或类似的东西(通常用于测试,“值”可能是“0”)

you may get this mistake "The mysql driver is not currently installed" if you use

如果您使用,您可能会收到此错误“当前未安装 mysql 驱动程序”

So any Syntax Error within the php.ini might generate this mistake. If you setup your system carefully always you might get confused easily, because you know, there are no mistakes at db installation or settings. If everthing else is correct, so go for a syntax error in php.ini.

所以 php.ini 中的任何语法错误都可能产生这个错误。如果你总是小心地设置你的系统,你可能很容易混淆,因为你知道,db 安装或设置没有错误。如果其他一切都正确,那么请在 php.ini 中查找语法错误。