略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: 安装

2024-12-20

安装

为添加 PostgreSQL 支持,在编译 PHP 时需要加上 --with-pgsql[=DIR] 选项。如果可以用共享模块方式,PostgreSQL 模块可以在 php.iniextension 指令或者 dl() 函数加载。

add a noteadd a note

User Contributed Notes 7 notes

up
8
Serjik
12 years ago
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.

Cheers,
Serjik
up
1
sean at cockroachlabs dot com
5 years ago
Starting with PHP 7, on Ubuntu (i.e., 16+), you can run:

`sudo apt-get install php-pgsql`
up
-1
Anonymous
5 years ago
for php 7, "sudo apt install php7.0-pgsql" worked for me
up
-4
Anto Binish Kaspar
12 years ago
An easy way to install in ubuntu(debain)
Just run " apt-get install php5-pgsql "
up
-19
zonetejasmikel at yahoo dot com
8 years ago
if you get
/pgsql.c:789: error: 'from' undeclared (first use in this function)
etc. compiling in linux its a typo in the define of pgsql.c file

change to this
#if !HAVE_PQESCAPE_CONN
#define PQescapeStringConn(conn, to, from, len, error) PQescapeString(to, from, len)
#endif
up
-23
samuel+php dot net at dionne-riel dot com
11 years ago
On PHP 5.3, you may encounter this error.
    Cannot create new link. Too many open links

I did with Archlinux. pgsql.so was active.

To resolve the issue, I had to active pdo.so and pdo_pgsql.so. Hope this helps!
up
-30
Simon
13 years ago
Windows users should be mindful that since 5.2.6 it seems that the version of php_pgsql.dll supplied is dynamically linked and requires libpq.dll.

The version supplied in 5.2.5 is statically linked and does not have this dependency, if you cannot load the Postgres extension grab php_pgsql.dll from the 5.2.5 distribution

官方地址:https://www.php.net/manual/en/pgsql.installation.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3