Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

The PDO extension is required for this adapter but the extension is not loaded

Posted on 2009-04-07
10
3,309 Views
Last Modified: 2013-11-10
I get the following error when trying to connect to a Postgresql database. In phpinfo there is no mention of postgresql, pgsql or pdo. Looking in the files of XAMPP/PHP (5.2.3), I can find the file php_pgsql.dll. I've uncommented the line "extension=php_pgsql.dll" in php.ini (there are two of those), but it won't work. Any ideas?

Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message
'The PDO extension is required for this adapter but the extension is not loaded' in
D:\web\zend1\library\Zend\Db\Adapter\Pdo\Abstract.php:107 Stack trace: #0
D:\web\zend1\library\Zend\Db\Adapter\Abstract.php(770): Zend_Db_Adapter_Pdo_Abstract->_connect() #1
D:\web\zend1\library\Zend\Db\Adapter\Pdo\Pgsql.php(151): Zend_Db_Adapter_Abstract->quote('albums') #2
D:\web\zend1\library\Zend\Db\Table\Abstract.php(696): Zend_Db_Adapter_Pdo_Pgsql->describeTable('albums', NULL) #3
D:\web\zend1\library\Zend\Db\Table\Abstract.php(739): Zend_Db_Table_Abstract->_setupMetadata() #4 D:\web\zend1\library\Zend\Db\Table\Abstract.php(846):
Zend_Db_Table_Abstract->_setupPrimaryKey() #5 D:\web\zend1\library\Zend\Db\Table\Select.php(99):
Zend_Db_Table_Abstract->info() #6 D:\web\zend1\library\Zend\Db\Table\Select.php(77):
Zend_Db_Table_Select->setTable(Object(Albums)) #7 D:\web\zend1\library\Zend\Db\Table\Abstract.php(881):
Zend_Db_Table_Select->__construct(Object(Albums)) #8 in
D:\web\zend1\library\Zend\Db\Adapter\Pdo\Abstract.php on line 107
0
Comment
Question by:R7AF
  • 5
  • 3
  • 2
10 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 24086957
ZF needs the pdo so you need to activate first thte php_pdo.dll and then the pdo pgsql dll must be loaded.

See http://www.php.net/manual/en/ref.pdo-pgsql.php
0
 
LVL 13

Author Comment

by:R7AF
ID: 24087178
I have the following extensions enabled. After restarting Apache it still doesn't work. (And I searched both php.ini for "pg" to see if I missed something, but couldn't find anything strange.)
extension=php_pdo.dll
extension=php_pdo_pgsql.dll
extension=php_pgsql.dll

Open in new window

0
 
LVL 3

Expert Comment

by:sreindl04
ID: 24090540
We've had the same problem. For whatever reason he pg libraries are not parsing the path correctly (at least it seems so). Please copy the *.dll files from the postgres bin directory to the apache bin folder.

PLEASE MAKE BACKUPS BEFORE AND DO NOT OVERWRITE EXISITING FILES.

That helped at least for our site.

The drawback of this solution is that whenever you upgrade your postgres you should also hav to update the dll files manuall.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 13

Author Comment

by:R7AF
ID: 24094797
Thanks for the tip. I've tried it but it doesn't work. In the end I copied all postgresql bin-files to the apache bin, but no change. But looking at the path still might be a good idea.
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 24094803
check the error log of apache,
make sure the postgres library directory is present in PATH (you need to reboot the server after you change the global settings for PATH, *yeah windows*) so no need to copy libs if you setup PATH correctly
0
 
LVL 3

Expert Comment

by:sreindl04
ID: 24094845
Using the path variable didn't work for us.
0
 
LVL 13

Author Comment

by:R7AF
ID: 24095170
I've changed the path, but that didn't fix it. The logs show some errors though:

PHP Warning:  PHP Startup: pdo_pgsql: Unable to initialize module\nModule compiled with module API=20060613, debug=0, thread-safety=0\nPHP    
compiled with module API=20060613, debug=0, thread-safety=1\nThese options need to match\n in Unknown on line 0
PHP Warning:  PHP Startup: pgsql: Unable to initialize module\nModule compiled with module API=20060613, debug=0, thread-safety=0\nPHP    
compiled with module API=20060613, debug=0, thread-safety=1\nThese options need to match\n in Unknown on line 0
0
 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 500 total points
ID: 24095185
So your php_*.dll do not match the installed PHP version. You need to fix either your extension_dir or correctly install and configure your PHP
The php_*.dll needs to be from the zip/installer of your used PHP.
0
 
LVL 13

Author Comment

by:R7AF
ID: 24095521
I found the cause of the problem. The php.ini loaded is not in the XAMPP folder, but in the Zend folder:

C:\Program Files\Zend\Core\etc\php.ini

I installed Zend Core, but still use XAMPP. For some reason XAMPP uses the php.ini from the Zend Core Apache installation. I removed the zend/core/etc from the Windows PATH, but it still loads. Using the Zend Apache, the page works and I can see data from the database. Now I need to decide how to fix this so it works like I want to.
0
 
LVL 13

Author Comment

by:R7AF
ID: 24097297
For those interested, I posted another question about this...
http://www.experts-exchange.com/Q_24305514.html
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
000webhost.com default error log 1 39
MVC - procedural PHP 10 34
IP 10.0.1.2 / 255.0.0.0 61 56
Log in through ID 5 17
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question