This happened to me also with PHP 5.4.1
Copying the offending DLL everywhere didn't worket, and I don't have Postgres 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 refering to the libpq.dll that comes bundled with PHP, like this:
LoadFile "C:/php/libpq.dll"
After that it worked fine to me.
(c) https://stackoverflow.com/users/1373641/dayron-armas-peña
from: https://stackoverflow.com/questions/551734/php-not-loading-php-pgsql-dll-on-windows/10439560#10439560