Message: The PDO extension is required for this ad

2019-09-17 16:31发布

问题:

An error occurred
Application error
Exception information:

Message: The PDO extension is required for this adapter but the extension is not loaded Stack trace:

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

Request Parameters:

array (
  'controller' => 'index',
  'action' => 'index',
  'module' => 'default',
)  

what i can do please Help me ?

回答1:

Install the PDO module for your database engine, using PECL. For example:

pecl install pdo
pecl install pdo_mysql

And load the extensions in your php.ini file, by adding these lines:

extension=pdo.so
extension=pdo_mysql.so


回答2:

apt-get should be good for this, and as I recall the PDO version is in the php5-mysql package:

For Debian based OS (apt-get)

sudo apt-get install php5-mysql

For MacPorts

php5-mysql @5.3.8 (php, databases) - a PHP interface to MySQL databases, including the mysql, mysqli and pdo_mysql extensions

sudo port install php5-mysql