oneinstatck 安装的php7 ,如何安装postgresql的驱动

问答中心分类: PHPoneinstatck 安装的php7 ,如何安装postgresql的驱动
qxzs_wangqiang 提问 2年 前

通过php-pgsql 安装的,好像版本不对
安装会提示:php-pgsql-5.3.3-46.el6_7.1.x86_64 already installed and latest version
已经通过以下命令安装了postgresql
yum localinstall http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

yum install postgresql94-server

php7的php-config 新增了–with-pdo-pgsql ,后面没写路径

并且成功的重新编译了php,但依然没安装好postgresql的驱动。烦请高手指点啊

 

10 问题
ptsa 回答 3月 前

编译 pgsql
出错

Start your code here
/bin/bash /root/oneinstack/src/php-7.1.9/ext/pgsql/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/oneinstack/src/php-7.1.9/ext/pgsql -DPHP_ATOM_INC -I/root/oneinstack/src/php-7.1.9/ext/pgsql/include -I/root/oneinstack/src/php-7.1.9/ext/pgsql/main -I/root/oneinstack/src/php-7.1.9/ext/pgsql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/include/postgresql -DHAVE_CONFIG_H -g -O2 -c /root/oneinstack/src/php-7.1.9/ext/pgsql/pgsql.c -o pgsql.lo
mkdir .libs
cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/root/oneinstack/src/php-7.1.9/ext/pgsql -DPHP_ATOM_INC -I/root/oneinstack/src/php-7.1.9/ext/pgsql/include -I/root/oneinstack/src/php-7.1.9/ext/pgsql/main -I/root/oneinstack/src/php-7.1.9/ext/pgsql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/include/postgresql -DHAVE_CONFIG_H -g -O2 -c /root/oneinstack/src/php-7.1.9/ext/pgsql/pgsql.c -fPIC -DPIC -o .libs/pgsql.o
/root/oneinstack/src/php-7.1.9/ext/pgsql/pgsql.c: In function ‘zif_pg_last_oid’:
/root/oneinstack/src/php-7.1.9/ext/pgsql/pgsql.c:3151:27: error: assignment to expression with array type
Z_STRVAL_P(return_value) = (char *) PQoidStatus(pgsql_result);
^
Makefile:194: recipe for target 'pgsql.lo' failed
make: *** [pgsql.lo] Error 1
 
ptsa 回答 3月 前

configure pdo_pgsql 出错

Start your code here

checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... gawk
checking for PostgreSQL support for PDO... yes, shared
checking for pg_config... /usr/bin/pg_config
checking for openssl dependencies... no
checking for PQprepare in -lpq... no
configure: error: Unable to build the PDO PostgreSQL driver: a newer libpq is required

oneinstack 回答 3月 前

缺少libpq,如下命令之后再试试:
yum -y install postgresql-libs 

ptsa 回答 3月 前

用的ubuntui  没有这个包
ubuntu 要装那些包?

ptsa 回答 3月 前

官方哪里提示的都已经安装

root@ttr1:~# apt-get install postgresql-contrib-9.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-contrib-9.6 is already the newest version (9.6.5-1.pgdg17.04+1).
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
root@ttr1:~# apt-get install libpq-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpq-dev is already the newest version (9.6.5-1.pgdg17.04+1).
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
root@ttr1:~# apt-get install postgresql-server-dev-9.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-server-dev-9.6 is already the newest version (9.6.5-1.pgdg17.04+1).
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
root@ttr1:~# apt-get install postgresql-client-9.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-client-9.6 is already the newest version (9.6.5-1.pgdg17.04+1).
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.