Solved

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

Posted on 2009-04-07
10
3,267 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
 
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 look for a specific file type in a local or remote server directory using PHP.

920 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

14 Experts available now in Live!

Get 1:1 Help Now