LoginSignup
0
0

More than 3 years have passed since last update.

phpbrew に postgreSQL の拡張モジュールをインストール

Last updated at Posted at 2019-09-12

CentOS6.8 に php7.3.9 をphpbrewからインストールするときにハマったのでメモ。
結論からいうと、なんか知らんけど入ってるっぽいという印象。

# phpbrew install 7.3.9 +default +dbs

checking for pg_config... not found
Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

phpbrewからPostgreSQLを見れないらしい。

# rpm -qa | grep postgresql
postgresql96-libs-9.6.15-1PGDG.rhel6.x86_64
postgresql96-9.6.15-1PGDG.rhel6.x86_64
postgresql96-server-9.6.15-1PGDG.rhel6.x86_64

postgresql-develが入っていないので、インストール

# yum install postgresql96-devel

もう一度、 phpbrew install したら入った。

次に、拡張モジュールをインストールする

# phpbrew ext install pgsql
===> Installing pgsql extension...
Log stored at: /root/.phpbrew/build/php-7.3.9/ext/pgsql/build.log
Changing directory to /root/.phpbrew/build/php-7.3.9/ext/pgsql
===> Phpize...
Error: Command failed: phpize > /root/.phpbrew/build/php-7.3.9/ext/pgsql/build.log 2>&1 returns:

失敗したので、ログを見てみる

# cat /root/.phpbrew/build/php-7.3.9/ext/pgsql/build.log
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
configure.ac:3: error: Autoconf version 2.68 or higher is required
configure.ac:3: the top level
autom4te: /usr/bin/m4 failed with exit status: 63

autoconf のバージョンが低いようなので、バージョンを上げる
(あとから考えるとrpmを探せば良かった)

# curl -L -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
# tar zxvf autoconf-latest.tar.gz
# cd autoconf-2.69/
# ./configure
# make
# sudo make install

もう一度、モジュールをインストールする

# phpbrew ext install pgsql
===> Installing pgsql extension...
Log stored at: /root/.phpbrew/build/php-7.3.9/ext/pgsql/build.log
Changing directory to /root/.phpbrew/build/php-7.3.9/ext/pgsql
===> Phpize...
===> Configuring...
Error: Command failed: ./configure --with-php-config=/root/.phpbrew/php/php-7.3.9/bin/php-config >> /root/.phpbrew/build/php-7.3.9/ext/pgsql/build.log 2>&1 returns:

ログの中身↓

checking for pg_config... not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

コマンドのオプション追加を調べる

# phpbrew ext show pgsql
                Name: pgsql
    Source Directory: /root/.phpbrew/build/php-7.3.9/ext/pgsql
              Config: /root/.phpbrew/build/php-7.3.9/ext/pgsql/config.m4
            INI File: /root/.phpbrew/php/php-7.3.9/var/db/pgsql.ini
           Extension: Core
                Zend: no
              Loaded: no

   Configure Options: 

        --with-pgsql[=DIR]               for PostgreSQL support

下記のコマンドを試したが変わりなし。

# phpbrew ext install pgsql --with-pgsql=/usr/pgsql-9.6/bin/
# yum install php73-php-pgsql

もう一度、phpbrewからインストールしてみる。
dbs を別々に分けてみる

# phpbrew install 7.3.9 +default +sqlite +mysql +pdo +pgsql

もう一度、拡張モジュールをインストールしようとしても同じエラーが表示されたが、phpinfo()を見たら無事にインストールされていた。なんだこれ・・・・

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0