通过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 Answers
oneinstack php是源码安装不能再使用源码安装php相关模块,方法如下:
cd oneinstack/src
yum -y install postgresql-devel #安装依赖
tar xzf php-7.0.6.tar.gz
cd php-7.0.6/ext/pgsql
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
echo 'extension=pgsql.so' > /usr/local/php/etc/php.d/ext-pgsql.ini
pdo-pgsql不需要吗?另外:
yum -y install postgresql-devel ,安装的是8.4
目的数据库是9.4版本,这样能行吗?
pgsql.so加载正常,laravel程序还是提示找不到驱动
还需要编译pdo_pgsql.so
cd oneinstack/src
yum -y install postgresql94-devel #安装依赖,最新的9.4版本
tar xzf php-7.0.6.tar.gz
cd php-7.0.6/ext/pdo_pgsql
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
然后在php.ini中手动添加
extension = "pgsql.so"
extension = "pdo_pgsql.so"
编译 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
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
官方哪里提示的都已经安装
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.
Please login or Register to submit your answer