此适配器需要PDO扩展名,但未加载该扩展名 [英] The PDO extension is required for this adapter but the extension is not loaded

查看:120
本文介绍了此适配器需要PDO扩展名,但未加载该扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用Zend_Db_Table_Abstract类的fetchall方法时出现以下异常...

 一个错误发生4545 
EXCEPTION_OTHER
异常信息:
消息:此适配器需要PDO扩展名,但未加载扩展名

堆栈跟踪:
#0 D:\www\TestProject\library\Zend\Db\Adapter\Pdo\Mysql.php(96):Zend_Db_Adapter_Pdo_Abstract-> _connect()
#1 D:\www \TestProject\library\Zend\Db\Adapter\Abstract.php(448):Zend_Db_Adapter_Pdo_Mysql-> _connect()
#2 D:\www\TestProject\library\ Zend\Db\Adapter\Pdo\Abstract.php(238):Zend_Db_Adapter_Abstract-> query('DESCRIBE`album ...',Array)
#3 D:\www\TestProject \库\Zend\Db\Adapter\Pdo\Mysql.php(156):Zend_Db_Adapter_Pdo_Abstract-> query('DESCRIBE`album ...')
#4 D:\www \TestProject\库\Zend\Db\Table\Abstract.php(823):Zend_Db_Adapter_Pdo_Mysql-> describeTable('albums',NULL)
# 5 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(862):Zend_Db_Table_Abstract-> _setupMetadata()
#6 D:\www\ TestProject\library\Zend\Db\Table\Abstract.php(969):Zend_Db_Table_Abstract-> _setupPrimaryKey()
#7 D:\www\TestProject\library\Zend\ \Db\Table\Select.php(100):Zend_Db_Table_Abstract-> info()
#8 D:\www\TestProject\library\Zend\Db\Table\Select .php(78):Zend_Db_Table_Select-> setTable(Object(Application_Model_Albums))
#9 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(1005 ):Zend_Db_Table_Select-> __ construct(Object(Application_Model_Albums))
#10 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(1303):Zend_Db_Table_Abstract- > select()
#11 D:\www\TestProject\application\controllers\IndexController.php(17):Zend_Db_Table_Abstract-> fetchAll()
#12 D:\ \www\TestProject\library\Zend\Controller\Action.php(513):IndexController-> indexAction()
#13 D:\www\TestProject\ \library\Zend\Controller\Dispatcher\Standard.php(289):Zend_Controller_Action-> dispatch('indexAction')
#14 D:\www\TestProject\library\Zend \Controller\Front.php(954):Zend_Controller_Dispatcher_Standard-> dispatch(Object(Zend_Controller_Request_Http),Object(Zend_Controller_Response_Http))
#15 D:\www\TestProject\library\Zend\ Application\Bootstrap\Bootstrap.php(97):Zend_Controller_Front-> dispatch()
#16 D:\www\TestProject\library\Zend\Application.php(366):Zend_Application_Bootstrap_Bootstrap -> run()
#17 D:\www\TestProject\public\index.php(26):Zend_Application-> run()
#18 {main}
请求参数:
数组(
'controller'=> ‘index’,
‘action’=> ‘index’,
‘module’=> 'default',

我在php.ini文件中添加了以下几行

  extension = pdo.so 
extension = pdo_mysql.so

extension = php_pdo。 dll
extension = php_pdo_mssql.dll

我也有 PDO MySQL软件包安装在我的系统中。但我仍然遇到上述异常。...(还重新启动了Apache服务器)

解决方案

首先,您不能两者都有c>

其中哪个用于Linux,以及:

  extension = php_pdo.dll 
扩展名= php_pdo_mssql.dll

对于Windows:您



就像在Windows上一样,您应该使用 .dll 版本。





但请注意,您使用的是:

  extension = php_pdo_mssql.dll 

ie 您加载了 pdo_mssql 扩展名-适用于Microsoft SQL Server,而不是MySQL。



相反,您应该加载MySQL扩展:

  extension = php_pdo_mysql.dll 

更正后,重新启动Apache;





如果情况没有好转,则应检查 phpinfo( )




  • phpinfo()开头的输出,它指示哪个 php.ini 文件已加载;确保您修改了正确的版本。

  • 检查文件中的下半部分,是否有关于 pdo_mysql
    的部分

    • 如果没有,请检查Apache的error_log,以防万一;-)



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:\www\TestProject\library\Zend\Db\Adapter\Pdo\Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 D:\www\TestProject\library\Zend\Db\Adapter\Abstract.php(448): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 D:\www\TestProject\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('DESCRIBE `album...', Array)
#3 D:\www\TestProject\library\Zend\Db\Adapter\Pdo\Mysql.php(156): Zend_Db_Adapter_Pdo_Abstract->query('DESCRIBE `album...')
#4 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(823): Zend_Db_Adapter_Pdo_Mysql->describeTable('albums', NULL)
#5 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(862): Zend_Db_Table_Abstract->_setupMetadata()
#6 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(969): Zend_Db_Table_Abstract->_setupPrimaryKey()
#7 D:\www\TestProject\library\Zend\Db\Table\Select.php(100): Zend_Db_Table_Abstract->info()
#8 D:\www\TestProject\library\Zend\Db\Table\Select.php(78): Zend_Db_Table_Select->setTable(Object(Application_Model_Albums))
#9 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(1005): Zend_Db_Table_Select->__construct(Object(Application_Model_Albums))
#10 D:\www\TestProject\library\Zend\Db\Table\Abstract.php(1303): Zend_Db_Table_Abstract->select()
#11 D:\www\TestProject\application\controllers\IndexController.php(17): Zend_Db_Table_Abstract->fetchAll()
#12 D:\www\TestProject\library\Zend\Controller\Action.php(513): IndexController->indexAction()
#13 D:\www\TestProject\library\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('indexAction')
#14 D:\www\TestProject\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#15 D:\www\TestProject\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#16 D:\www\TestProject\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#17 D:\www\TestProject\public\index.php(26): Zend_Application->run()
#18 {main}  
Request Parameters:
array (
  'controller' => 'index',
  'action' => 'index',
  'module' => 'default',
)  

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 

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

Which are for Linux, and :

extension=php_pdo.dll 
extension=php_pdo_mssql.dll 

Which are for windows : you've got to choose, depending on the system you are using.

As you are on windows, you should use the .dll version.


But note that you used :

extension=php_pdo_mssql.dll 

i.e. you loaded the pdo_mssql extension -- which is for Microsoft SQL Server, and not MySQL.

Instead, you should load the extension for MySQL :

extension=php_pdo_mysql.dll 

After correcting that, restart Apache ; and things should get better.


If things don't get better, you should check the output of phpinfo() :

  • At the beginning of phpinfo()'s output, it indicates which php.ini file is loaded ; make sure you modified the right one.
  • Check, lower in the file, if there is a section about pdo_mysql
    • If not, check Apache's error_log, just in case ;-)

这篇关于此适配器需要PDO扩展名,但未加载该扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆