PHP not loading php_pgsql.dll on Windows


PHP 5.2.8 is refusing to load php_pgsql.dll, with the following error:

Warning: PHP Startup: Unable to load dynamic library 'D:\PHP\ext\php_pgsql.dll' - The specified module could not be found.

in Unknown on line 0

The .dll exists in PHP/ext/.

Has anyone else had this problem with PHP on Windows before?

2/15/2009 10:31:52 PM

Accepted Answer

Check out the info on the PHP PostgreSQL installation page:

On a Windows server, configured with Apache, adding the following line to httpd.conf to load libpq.dll can save you a lot of time :

LoadFile "C:/Program Files/PostgreSQL/8.4/bin/libpq.dll"

Note that you will have to change your folder accordingly to the installation path and version of PostgreSQL you have installed. Also note that having Apache and PostgreSQL on the same server for production environments is not recommended.

This fixed my setup instantly.

4/14/2011 3:01:10 AM

This happened to me also with PHP 5.4.1

Copying the offending DLL everywhere didn't worked, and I don't have PostgreSQL installed in the server, but also planned to use PHP against different Postgres versions, so the only solution I found that worked was to put in httpd.conf a line like this:

LoadFile "C:/Program Files/PostgreSQL/8.4/bin/libpq.dll"

But referring to the libpq.dll that comes bundled with PHP, like this:

LoadFile "C:/php/libpq.dll"

After that it worked fine to me.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow