Ubuntu16.04下使用lnmp软件包搭建开发环境安装扩展pdo_pgsql扩展报错Can't find the 'libpq-fe.h header

1.安装pgsql扩展

ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pgsql$ phpize 
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
ming@ming-TM1604:~/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql$ ./configure --with-php-config=/usr/local/php/bin/php-config
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... yes, shared
checking for pg_config... /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

由于该文件是libpq-dev软件包的一部分,需要安装该软件包:

ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pgsql$ sudo apt-get install libpq-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列软件包是自动安装的并且现在不需要了:
  php-common
使用'sudo apt autoremove'来卸载它(它们)。
建议安装:
  postgresql-doc-9.5
下列【新】软件包将被安装:
  libpq-dev
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 6 个软件包未被升级。
需要下载 0 B/154 kB 的归档。
解压缩后会消耗 786 kB 的额外空间。
正在选中未选择的软件包 libpq-dev。
(正在读取数据库 ... 系统当前共安装有 227218 个文件和目录。)
正准备解包 .../libpq-dev_9.5.12-0ubuntu0.16.04_amd64.deb  ...
正在解包 libpq-dev (9.5.12-0ubuntu0.16.04) ...
正在处理用于 man-db (2.7.5-1) 的触发器 ...
正在设置 libpq-dev (9.5.12-0ubuntu0.16.04) ...
ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pgsql$

再次安装不会报错

ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pgsql$ ./configure --with-php-config=/usr/local/php/bin/php-config
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... yes, shared
checking for pg_config... /usr/bin/pg_config
checking for PQescapeString in -lpq... yes
checking for PQunescapeBytea in -lpq... yes
checking for PQsetnonblocking in -lpq... yes
checking for PQcmdTuples in -lpq... yes
checking for PQoidValue in -lpq... yes
checking for PQclientEncoding in -lpq... yes
checking for PQparameterStatus in -lpq... yes
checking for PQprotocolVersion in -lpq... yes
checking for PQtransactionStatus in -lpq... yes
checking for PQexecParams in -lpq... yes
checking for PQprepare in -lpq... yes
checking for PQexecPrepared in -lpq... yes
checking for PQresultErrorField in -lpq... yes
checking for PQsendQueryParams in -lpq... yes
checking for PQsendPrepare in -lpq... yes
checking for PQsendQueryPrepared in -lpq... yes
checking for PQputCopyData in -lpq... yes
checking for PQputCopyEnd in -lpq... yes
checking for PQgetCopyData in -lpq... yes
checking for PQfreemem in -lpq... yes
checking for PQsetErrorVerbosity in -lpq... yes
checking for PQftable in -lpq... yes
checking for PQescapeStringConn in -lpq... yes
checking for PQescapeByteaConn in -lpq... yes
checking for pg_encoding_to_char in -lpq... yes
checking for lo_create in -lpq... yes
checking for lo_import_with_oid in -lpq... yes
checking for lo_truncate in -lpq... yes
checking for lo_truncate64 in -lpq... yes
checking for PQescapeLiteral in -lpq... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pgsql$ make &&sudo make install
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/pgsql.c -o pgsql.lo 
mkdir .libs
 cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/pgsql.c  -fPIC -DPIC -o .libs/pgsql.o
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/libtool --mode=link cc -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/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   -o pgsql.la -export-dynamic -avoid-version -prefer-pic -module -rpath /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/modules  pgsql.lo -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lpq
cc -shared  .libs/pgsql.o  -L/usr/lib/x86_64-linux-gnu -lpq  -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu -Wl,-soname -Wl,pgsql.so -o .libs/pgsql.so
creating pgsql.la
(cd .libs && rm -f pgsql.la && ln -s ../pgsql.la pgsql.la)
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/libtool --mode=install cp ./pgsql.la /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/modules
cp ./.libs/pgsql.so /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/modules/pgsql.so
cp ./.libs/pgsql.lai /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/modules/pgsql.la
PATH="$PATH:/sbin" ldconfig -n /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/
ming@ming-TM1604:~/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pgsql$

2.安装pdo_pgsql

ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pgsql$ cd ..  
ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext$ cd pdo_pgsql/  
ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql$ phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql$ ls
acinclude.m4    config.sub    Makefile.global    php_pdo_pgsql.h
aclocal.m4      configure     missing            php_pdo_pgsql_int.h
autom4te.cache  configure.in  mkinstalldirs      run-tests.php
build           config.w32    package2.xml       tests
config.guess    CREDITS       pdo_pgsql.c
config.h.in     install-sh    pgsql_driver.c
config.m4       ltmain.sh     pgsql_statement.c
ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql$ ./configure --with-php-config=/usr/local/php/bin/php-config
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... yes
checking for PQexecParams in -lpq... yes
checking for PQescapeStringConn in -lpq... yes
checking for PQescapeByteaConn in -lpq... yes
checking for PDO includes... checking for PDO includes... /usr/local/php/include/php/ext
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
ming@ming-TM1604:~/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql$ make && sudo make install
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/libtool --mode=compile cc -I/usr/local/php/include/php/ext  -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/pdo_pgsql.c -o pdo_pgsql.lo 
mkdir .libs
 cc -I/usr/local/php/include/php/ext -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/pdo_pgsql.c  -fPIC -DPIC -o .libs/pdo_pgsql.o
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/libtool --mode=compile cc -I/usr/local/php/include/php/ext  -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/pgsql_driver.c -o pgsql_driver.lo 
 cc -I/usr/local/php/include/php/ext -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/pgsql_driver.c  -fPIC -DPIC -o .libs/pgsql_driver.o
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/libtool --mode=compile cc -I/usr/local/php/include/php/ext  -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/pgsql_statement.c -o pgsql_statement.lo 
 cc -I/usr/local/php/include/php/ext -I. -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_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 /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/pgsql_statement.c  -fPIC -DPIC -o .libs/pgsql_statement.o
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/libtool --mode=link cc -DPHP_ATOM_INC -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/include -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/main -I/home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_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   -o pdo_pgsql.la -export-dynamic -avoid-version -prefer-pic -module -rpath /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/modules  pdo_pgsql.lo pgsql_driver.lo pgsql_statement.lo -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lpq
cc -shared  .libs/pdo_pgsql.o .libs/pgsql_driver.o .libs/pgsql_statement.o  -L/usr/lib/x86_64-linux-gnu -lpq  -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu -Wl,-soname -Wl,pdo_pgsql.so -o .libs/pdo_pgsql.so
creating pdo_pgsql.la
(cd .libs && rm -f pdo_pgsql.la && ln -s ../pdo_pgsql.la pdo_pgsql.la)
/bin/bash /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/libtool --mode=install cp ./pdo_pgsql.la /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/modules
cp ./.libs/pdo_pgsql.so /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/modules/pdo_pgsql.so
cp ./.libs/pdo_pgsql.lai /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/modules/pdo_pgsql.la
PATH="$PATH:/sbin" ldconfig -n /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /home/ming/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/
ming@ming-TM1604:~/lnmp1.4/lnmp1.4/src/php-7.1.15/ext/pdo_pgsql$ 

3.配置php.ini

打开php.ini文件将pdo_pgsql.dll去掉注释并改为extension=pdo_pgsql.so

(非lnmp包安装的话需要跟上pdo_pgsql.so或者pgsql的完整路径)

安装完成后打开网页在phpInfo能看到pdo_pgsql的信息,或者运行php -m查看扩展是否有这个东东
pdo_pgsql
PDO Driver for PostgreSQL enabled
PostgreSQL(libpq) Version 9.5.12
Module version 7.1.15

Revision $Id: 9c5f356c77143981d2e905e276e439501fe0f419 $

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值