php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60195 Unable to load dynamic library php_pgsql.dll
Submitted: 2011-11-01 19:57 UTC Modified: 2011-11-02 09:21 UTC
From: wikeno at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.8 OS: Windows 7 x64
Private report: No CVE-ID: None
 [2011-11-01 19:57 UTC] wikeno at gmail dot com
Description:
------------
PHP fails to load pgsql extension.

Error message: PHP Startup: Unable to load dynamic library '...\php\ext\php_pgsql.dll' -%1 is not a valid Win32 application




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-01 20:12 UTC] pajoye@php.net
Be sure to have the libpq.dll in your PATH or the current dir:


c:\test\538ts>php -d extension_dir=ext -d extension=php_pgsql.dll -m | find 
"pgsql"
pgsql


works just fine (libpq.dll being in the current dir).
 [2011-11-01 20:12 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2011-11-02 09:12 UTC] wikeno at gmail dot com
That's strange! Running php from command line works fine. The problem occurs when using php as an Apache module.

Apache's error.log:

PHP Warning:  PHP Startup: Unable to load dynamic library '...\\php\\ext\\php_pgsql.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0
<br />
<b>Warning</b>:  PHP Startup: Unable to load dynamic library '...\php\ext\php_pgsql.dll' - %1 is not a valid Win32 application.

 in <b>Unknown</b> on line <b>0</b><br />
[Wed Nov 02 10:07:04 2011] [notice] Child 2196: All worker threads have exited.
[Wed Nov 02 10:07:04 2011] [notice] Child 2196: Child process is exiting
[Wed Nov 02 10:07:04 2011] [notice] Apache/2.2.21 (Win32) PHP/5.3.8 configured -- resuming normal operations
[Wed Nov 02 10:07:04 2011] [notice] Server built: Sep  9 2011 10:26:10
[Wed Nov 02 10:07:04 2011] [notice] Parent: Created child process 9068
PHP Warning:  PHP Startup: Unable to load dynamic library '...\\php\\ext\\php_pgsql.dll' - %1 is not a valid Win32 application.\r\n in Unknown on line 0
<br />
<b>Warning</b>:  PHP Startup: Unable to load dynamic library '...\php\ext\php_pgsql.dll' - %1 is not a valid Win32 application.

 in <b>Unknown</b> on line <b>0</b><br />
[Wed Nov 02 10:07:05 2011] [notice] Child 9068: Child process is running
[Wed Nov 02 10:07:05 2011] [notice] Child 9068: Acquired the start mutex.
[Wed Nov 02 10:07:05 2011] [notice] Child 9068: Starting 64 worker threads.
[Wed Nov 02 10:07:05 2011] [notice] Child 9068: Starting thread to listen on port 80. 


Apache starts, but PostgreSQL doesnt appear in phpinfo().

I have libpq.dll in PATH.
 [2011-11-02 09:21 UTC] pajoye@php.net
That's why I said "in your PATH", or where the other apache DLLs are. See the 
apache's documentation (php manual or apache's) for more info.
 [2014-03-04 01:39 UTC] nitin dot cool4urchat at gmail dot com
http://stackoverflow.com/a/10439560/566092
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 15:01:28 2025 UTC