且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

pgsql扩展未加载

更新时间:2023-12-05 20:09:10

[已解决]

好的,看了几个小时,我发现了问题,并且能够解决phpinfo()中未显示的pdo_pgsql和pgsql模块的问题.

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().

[解决方案]

取消注释php.ini中的扩展名后,进入httpd.conf并在所有LoadModule行的顶部添加以下内容:

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"

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

(假设您使用的是最新版本的PostgreSQL,否则将数字更改为您使用的版本).

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

保存并重新启动Apache.转到phpinfo(),您将看到它已加载.

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

[原因]

即使将Apachepg.dll复制到Apache/bin文件夹中,它也无法看到libpg.dll.

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

[环境]

  • Windows Server 2016(也适用于Windows 10)
  • Apache 2.4.26
  • (x64)PHP 7.1.8(x64 ThreadSafe VC14)
  • PostgreSQL 9.6.4(x64)