Skip to content
Advertisement

pgsql extension is not loading

I am trying to use pgsql extension on Windows 10 64-bit (WAPP).
I have:

  • restarted Apache
  • uncommented all postgresql extensions in php.ini
  • used LoadFile to load pgsql.dll
  • moved pgsql.dll to Apache bin (I tried both dll from php folder and from postgresql)

But still no result.
pgsql is visible only in php.exe -m but not in phpinfo(), extension_loaded(), get_loaded_extensions().
My php version is 7.1.8 and PostgreSQL is 9.6 and Apache is 2.4.27.
My php.exe -m output:
php -m
What can be the problem?

Advertisement

Answer

[SOLVED]

Okay, after a few hours of looking, I found the problem and was able to solve the problem with the pdo_pgsql and pgsql modules not showing in phpinfo().

[SOLUTION]

After uncommenting the extensions in php.ini, go into httpd.conf and add at the top of all the LoadModule lines the following:

LoadFile “C:/Program Files/PostgreSQL/9.6/bin/libpq.dll”

(assuming you are using the latest version of PostgreSQL, otherwise change the number to the version you are using).

Save and restart Apache. Go to phpinfo() and you will see it is loaded.

[REASON]

Apache is unable to see the libpg.dll even if you copy it into the Apache/bin folder.

[ENVIRONMENT]

  • Windows Server 2016 (works for Windows 10 as well)
  • Apache 2.4.26
  • (x64) PHP 7.1.8 (x64 ThreadSafe VC14)
  • PostgreSQL 9.6.4 (x64)
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement