1、安装postgresql基础包;
yum -y install postgresql-devel
2、进入php源码ext/pgsql目录进行php编译安装;
cd php-7.1.25/ext/pgsql/
/home/xshop/php71/bin/phpize
./configure --with-php-config=/home/xshop/php71/bin/php-config
make && make install
同时需要进入以下目录进行安装
[root@xshop 202108]# cd /tmp/php-7.1.25/ext/pdo_pgsql/
/home/xshop/php71/bin/phpize
./configure --with-php-config=/home/xshop/php71/bin/php-config
make && make install
3、执行以上命令后,可以进入此目录查看pgsql信息。
/home/xshop/php71/lib/php/extensions/no-debug-non-zts-20160303
[root@xshop no-debug-non-zts-20160303]# ll
total 8084
-rwxr-xr-x 1 xshop xshop 657008 Jan 16 2020 mysqli.so
-rwxr-xr-x 1 xshop xshop 3416548 Jan 16 2020 opcache.a
-rwxr-xr-x 1 xshop xshop 1639840 Jan 16 2020 opcache.so
-rwxr-xr-x 1 xshop xshop 248576 Jan 16 2020 pdo_sqlite.a
-rwxr-xr-x 1 xshop xshop 140264 Jan 16 2020 pdo_sqlite.so
-rwxr-xr-x 1 xshop xshop 549712 Aug 10 15:07 pgsql.so
-rwxr-xr-x 1 xshop xshop 1607872 Feb 17 2020 soap.so
[root@xshop no-debug-non-zts-20160303]#
4、编辑php.ini文件增加php扩展
vim /home/xshop/php71/etc/php.ini
extension=pgsql.so
extension=pdo_pgsql.so
5、重启php程序
systemctl restart php-fpm
6、查看php信息,可以看到php扩展安装成功。
[root@xshop /]# /home/xshop/php71/bin/php -m
可以看到pgsql和pdo_pgsql包已经安装成功。
PDO
pdo_mysql
pdo_pgsql
pgsql
Phar
posix
Reflection
文章评论