Solved

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

Posted on 2009-04-07
10
3,242 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 13

Author Comment

by:R7AF
Comment Utility
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
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 3

Expert Comment

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

Author Comment

by:R7AF
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
For those interested, I posted another question about this...
http://www.experts-exchange.com/Q_24305514.html
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 …

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now