views:

2400

answers:

8

I've checked the php.ini file the extensions are enabled:

extension=php_pdf.dll
extension=php_pdo.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll

but still when i try to open the page it gives the error

500 | Internal Server Error | PropelException Unable to open PDO connection [wrapped: could not find driver]

what do i need to do now? to eliminate this error

thanks

A: 

In php.ini set the following to check if there's a problem loading the extensions.

display_startup_errors = On
David Caunt
+1  A: 
  • Find out which PDO driver you actually need (MySQL, MS SQL...?)

  • Test by instantiating PDO yourself, to avoid errors elsewhere:

    $db = new PDO('mysql:host=127.0.0.1;dbname=testdb', 'username', 'password');

If you still get "could not find driver", now you can be sure that you're really missing it :)

How to install it, if you don't have it already, depends a lot on your system. On Debian Linux, for example, you need to do apt-get install php5-mysql, which installs mysql, mysqli and pdo_mysql extensions.

After you install it, ensure that it's enabled in php.ini. make sure that you're editing the correct file - the one that is used by your webserver.

Afterwards, to verify the extension was loaded correctly, either:

  • create a script which executes phpinfo(). You should see a PDO section with a key PDO drivers and a value such as "mysql, pgsql", or

  • run php -m from the command line and you should see pdo_mysql for example.

Jaka Jančar
A: 

The php_pdo_mysql.dll in the extension directory may be trying to load the libmysql.dll or mysql.dll which by default is in the php directory (I think - they are at least in my php directory but I installed it so long ago I can't remember if they were there by default or if I copied them there). If the php directory is not in your PATH these latter dll's will not be found and cause the error.

I would suggest checking that the libmysql.dll and/or mysql.dll is in your php directory. If so, add your php directory to your system's PATH and REBOOT your computer. I had the same problem, added the php directory to the system's path, restarted Apache and the problem wasn't solved. I needed to reboot before Apache/PHP would find the dll's in the php directory.

An alternative is to copy libmysql.dll and mysql.dll into a directory that is searched by default (is it the Windows directory or maybe the Window\System32 directory). When the php_pdo_mysql.dll is loaded it will then be able to find the dependent dlls.

If these two dlls aren't in your php directory, try downloading and installing MySQL. You may find these dlls in amongst the files installed my the MySQL installer.

If you're using Apache it should be reporting in the error log that it can't load php_pdo_mysql.dll. If not, maybe it's reporting some other error on start up. Posting any errors from the log maybe helpful for diagnosis.

Hope this helps.

Stacey Richards
A: 
  • I've had problems in the past where despite the DLL being in the php/ext/ directory and despite the php path being set properly, I had to specify the absolute path to the extension.

  • Check the Apache error logs to see if there was a problem loading the extension

A: 

Are you working with the Command line?

Often the command line and the PHP in the browser use different PHP.ini files.

Use phpinfo() to check the modules included on the borwser Use PHP -m to see the modules installed via the CLI

Jon Winstanley
A: 

I am getting the following error: The mysql driver is not currently installed I am trying to run the website with ZenderFramework

Application error
Exception information:
Message: The mysql driver is not currently installed 

Stack trace:
#0 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Adapter\Pdo\Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Adapter\Abstract.php(448): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('DESCRIBE `album...', Array)
#3 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Adapter\Pdo\Mysql.php(156): Zend_Db_Adapter_Pdo_Abstract->query('DESCRIBE `album...')
#4 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Table\Abstract.php(814): Zend_Db_Adapter_Pdo_Mysql->describeTable('albums', NULL)
#5 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Table\Abstract.php(857): Zend_Db_Table_Abstract->_setupMetadata()
#6 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Table\Abstract.php(964): Zend_Db_Table_Abstract->_setupPrimaryKey()
#7 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Table\Select.php(100): Zend_Db_Table_Abstract->info()
#8 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Table\Select.php(78): Zend_Db_Table_Select->setTable(Object(Model_DbTable_Albums))
#9 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Table\Abstract.php(1000): Zend_Db_Table_Select->__construct(Object(Model_DbTable_Albums))
#10 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Db\Table\Abstract.php(1286): Zend_Db_Table_Abstract->select()
#11 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\application\controllers\IndexController.php(16): Zend_Db_Table_Abstract->fetchAll()
#12 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Action.php(513): IndexController->indexAction()
#13 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('indexAction')
#14 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#15 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
#16 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\library\Zend\Application.php(346): Zend_Application_Bootstrap_Bootstrap->run()
#17 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\zf-tutorial\public\index.php(26): Zend_Application->run()
#18 {main}  Request Parameters:
array (
  'controller' => 'index',
  'action' => 'index',
  'module' => 'default',
)
cany
If you get different errors this should be as new question, not an answer to this one. The "Ask Question" button is in the top right.
sth
Also, this question might be better suited for http://www.serverfault.com/
sth
A: 

under which section do i have to put this "display_startup_errors = On"

cany
A: 

there are no errors in my Apache error logs

cany