当我尝试使用 Zend_Db_Table_Abstract 类的 fetchall 方法时,出现以下异常...
I am getting the following exception when i try to use the fetchall method of the Zend_Db_Table_Abstract class...
An error occurred4545
EXCEPTION_OTHER
Exception information:
Message: The PDO extension is required for this adapter but the extension is not loaded
Stack trace:
#0 D:wwwTestProjectlibraryendDbAdapterPdoMysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 D:wwwTestProjectlibraryendDbAdapterAbstract.php(448): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 D:wwwTestProjectlibraryendDbAdapterPdoAbstract.php(238): Zend_Db_Adapter_Abstract->query('DESCRIBE `album...', Array)
#3 D:wwwTestProjectlibraryendDbAdapterPdoMysql.php(156): Zend_Db_Adapter_Pdo_Abstract->query('DESCRIBE `album...')
#4 D:wwwTestProjectlibraryendDbTableAbstract.php(823): Zend_Db_Adapter_Pdo_Mysql->describeTable('albums', NULL)
#5 D:wwwTestProjectlibraryendDbTableAbstract.php(862): Zend_Db_Table_Abstract->_setupMetadata()
#6 D:wwwTestProjectlibraryendDbTableAbstract.php(969): Zend_Db_Table_Abstract->_setupPrimaryKey()
#7 D:wwwTestProjectlibraryendDbTableSelect.php(100): Zend_Db_Table_Abstract->info()
#8 D:wwwTestProjectlibraryendDbTableSelect.php(78): Zend_Db_Table_Select->setTable(Object(Application_Model_Albums))
#9 D:wwwTestProjectlibraryendDbTableAbstract.php(1005): Zend_Db_Table_Select->__construct(Object(Application_Model_Albums))
#10 D:wwwTestProjectlibraryendDbTableAbstract.php(1303): Zend_Db_Table_Abstract->select()
#11 D:wwwTestProjectapplicationcontrollersIndexController.php(17): Zend_Db_Table_Abstract->fetchAll()
#12 D:wwwTestProjectlibraryendControllerAction.php(513): IndexController->indexAction()
#13 D:wwwTestProjectlibraryendControllerDispatcherStandard.php(289): Zend_Controller_Action->dispatch('indexAction')
#14 D:wwwTestProjectlibraryendControllerFront.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#15 D:wwwTestProjectlibraryendApplicationBootstrapBootstrap.php(97): Zend_Controller_Front->dispatch()
#16 D:wwwTestProjectlibraryendApplication.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#17 D:wwwTestProjectpublicindex.php(26): Zend_Application->run()
#18 {main}
Request Parameters:
array (
'controller' => 'index',
'action' => 'index',
'module' => 'default',
)
我在php.ini文件中添加了以下几行
I have added the following lines in the php.ini file
extension=pdo.so
extension=pdo_mysql.so
extension=php_pdo.dll
extension=php_pdo_mssql.dll
我的系统中还安装了PDO MySQL 包.但我仍然收到上述异常......(还重新启动了Apache服务器)
Also i have The PDO MySQL package installed in my system. But still I am getting the above exception.... (Also restarted the Apache server)
首先,你不能同时拥有:
First of all, you cannot have both :
extension=pdo.so
extension=pdo_mysql.so
适用于 Linux,以及:
Which are for Linux, and :
extension=php_pdo.dll
extension=php_pdo_mssql.dll
哪些适用于 Windows:您必须选择,具体取决于您使用的系统.
Which are for windows : you've got to choose, depending on the system you are using.
在 Windows 上,您应该使用 .dll
版本.
As you are on windows, you should use the .dll
version.
但请注意,您使用了 :
But note that you used :
extension=php_pdo_mssql.dll
即您加载了 pdo_mssql
扩展——它用于 Microsoft SQL Server,而不是 MySQL.
i.e. you loaded the pdo_mssql
extension -- which is for Microsoft SQL Server, and not MySQL.
相反,您应该加载 MySQL 的扩展:
Instead, you should load the extension for MySQL :
extension=php_pdo_mysql.dll
更正后,重启Apache;情况应该会好转.
After correcting that, restart Apache ; and things should get better.
如果情况没有好转,您应该检查 phpinfo()
的输出:
phpinfo()
输出的开头,表示加载的是哪个php.ini
文件;确保你修改了正确的.pdo_mysql
的部分phpinfo()
's output, it indicates which php.ini
file is loaded ; make sure you modified the right one.pdo_mysql
这篇关于此适配器需要 PDO 扩展,但未加载扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!