?
Solved

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

Posted on 2009-04-07
10
Medium Priority
?
3,409 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
[X]
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
  • 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
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 2000 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 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