php 调用未定义的函数 pg_connect() - Wamp
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18907868/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Call to undefined function pg_connect() - Wamp
提问by student
I want to connect to PostgreSQL, Im using wamp 64 bit.
我想连接到 PostgreSQL,我使用 wamp 64 位。
I have here
我这里有
- Apache 2.4.2
- PHP 5.4.3
- Mysql 5.5.24
- 阿帕奇 2.4.2
- PHP 5.4.3
- mysql 5.5.24
I also uncomment in php.ini the php_pgsql and php_pdo_pgsql. but i can't connect , It gives me error like this :
我还在 php.ini 中取消了 php_pgsql 和 php_pdo_pgsql 的注释。但我无法连接,它给了我这样的错误:
Error suppression ignored for ( ! ) Fatal error: Call to undefined function pg_connect()
忽略错误抑制(!)致命错误:调用未定义的函数 pg_connect()
Is there anybody know the solution regarding on my problem. I just need it badly.
有没有人知道关于我的问题的解决方案。我只是非常需要它。
Thank you .
谢谢你 。
回答by Abdul Hamid
- Open php.ini
- Find
;extension=php_pgsql.dll
and remove the semicolon at the beginning - Find
;extension=php_pdo_pgsql.dll
and remove the semicolon at the beginning - Save the file
- Restart apache
- 打开 php.ini
- 查找
;extension=php_pgsql.dll
并删除开头的分号 - 查找
;extension=php_pdo_pgsql.dll
并删除开头的分号 - 保存文件
- 重启apache
Hope this helps
希望这可以帮助
回答by student
i Solve my problem in putting a LoadFile in httpd.conf
我解决了在 httpd.conf 中放置 LoadFile 的问题
LoadFile "location\libpq.dll";
LoadFile "location\libpq.dll";
First i uncomment the extension=php_pgsql.dll and extension=php_pdo_pgsql.dll then i put the LoadFile in httpd.conf then restart Apache and Wamp.
首先,我取消对 extension=php_pgsql.dll 和 extension=php_pdo_pgsql.dll 的注释,然后将 LoadFile 放在 httpd.conf 中,然后重新启动 Apache 和 Wamp。
Thank you guy's
谢谢你们
回答by user2695968
I think this will help you.
我认为这会对你有所帮助。
- Right click on my computer and select properties.
- Click on advance system settings
- On the system properties window click “environment variables”
- Look for system variables frame and click “Path” variable
- Click the “edit” button
- Change the variable value by adding your php root path. Mine looks like this:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\wamp\bin\php\php5.3.0\
Just added your php root path at the end. - Restart your wampserver and check mark the
pdo_pgsql
andphp_pgsql
extension using the wamp server menu or by editing your php.ini ; just remove the remark for the above extensions.
- 右键单击我的电脑并选择属性。
- 点击高级系统设置
- 在系统属性窗口中单击“环境变量”
- 查找系统变量框并单击“路径”变量
- 点击“编辑”按钮
- 通过添加您的 php 根路径来更改变量值。我的看起来像这样:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C: \Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\wamp\bin\php\php5.3.0\
刚刚在最后添加了您的 php 根路径。 - 重新启动您的 wampserver 并使用 wamp server 菜单或通过编辑您的 php.ini 来勾选
pdo_pgsql
和php_pgsql
扩展;只需删除上述扩展名的备注即可。
回答by dap.tci
Copy libpq.dll
from php folder (ex.: C:\wamp\bin\php\php5.5.12
) to apache bin folder (ex.: C:\wamp\bin\apache\apache2.4.9\bin
) then restart apache and be happy!
libpq.dll
从 php 文件夹(例如:)复制C:\wamp\bin\php\php5.5.12
到 apache bin 文件夹(例如:)C:\wamp\bin\apache\apache2.4.9\bin
然后重新启动 apache 并高兴!
回答by ohjeeez
In case any of that doesnt work, try this in your httpd.conf file under apache...
如果其中任何一个不起作用,请在 apache 下的 httpd.conf 文件中尝试此操作...
configure the path to php.ini
配置php.ini的路径
PHPIniDir "c:/wamp/bin/php/php5.5.12"
PHPIniDir "c:/wamp/bin/php/php5.5.12"