重新编译PHP7支持PostgreSQL

安装PostgreSQL

apt-get install postgresql postgresql-contrib postgresql-server-dev-9.3 libpq-dev

编译PHP增加PostgreSQL扩展

  1. 先看下之前编译的configure命令。

        php -i | grep configure
  2. 配置编译参数。在上面的configure命令后面加上--with-pdo-pgsql选项。

    ./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --without-gdbm --disable-fileinfo --with-pdo-pgsql=/usr/lib/postgresql/9.3
  3. 开始编译和安装。

    make && make install
  4. 安装完成后,检查PHP扩展。

    php -m | grep pdo_pgsql

    输出里有pdo_pgsql,就表示PostgreSQL的扩展ok了。

标签: PHP, postgresql

添加新评论