くまきち

山と旅と家族が大事。
でも激しい物欲が理性と財布のタガを飛ばす
最近は自転車も乗ってる

続・Mavericks 更新の弊害(PHP::PDO_PgSQL)

2013-10-26 22:02:57 | SEまわり
Lion → Mavericks に更新してからの話。

Lion の時の PHP は pdo_pgsql が有効だったのだが、なんかこれも変わってて無効。しかも、pdo_mysql は有効という差別的な扱い。
(MySQL は苦手)

PHP 自体をソースからインストールすることも考えてみたけど、extension で入れてしまえばいいんじゃないかと思い,やってみることにした。

  
# cd Downloads/php-5.4.20/ext/pdo_pgsql/
#ls
CREDITS config.w32 pgsql_driver.c
Makefile.global configure.in pgsql_statement.c
acinclude.m4 install-sh php_pdo_pgsql.h


ここで、extension ファイルを生成する。
が、phpize でエラー。最初からこれだ。

  
# bash-3.2$ phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.


やっぱりコマンドラインツールがぼろぼろ。
autoconf は command not found になる。
port で入れようとして、search name=autoconf とする。

  
# port search name=autoconf
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
No match for name=autoconf found


port selfupdate からやりなおせとの指示。
やります。

  
# port selfupdate
---> Updating MacPorts base sources using rsync
MacPorts base version 2.2.0 installed,
MacPorts base version 2.2.1 downloaded.
---> Updating the ports tree
---> MacPorts base is outdated, installing new version 2.2.1
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

Not all sources could be fully synced using the old version of MacPorts.
Please run selfupdate again now that MacPorts base has been updated.


もういちどやれってか。
はいはい。

  
# port selfupdate
---> Updating MacPorts base sources using rsync
MacPorts base version 2.2.1 installed,
MacPorts base version 2.2.1 downloaded.
---> Updating the ports tree
---> MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated


全部上げろと。
まあそうだろうね。んで、きっとこれで autoconf が使えるようになるんじゃないか。

  
# port upgrade outdated
(以下略)


1時間以上かかった。
でも終わったので、phpize に戻る。

  
# phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525


うまくいった。
configure ファイルもちゃんと生成されてる。
ということで、configure を実行する。

  
# ./configure --with-pdo-pgsql
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/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... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking target system type... i386-apple-darwin13.0.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for PostgreSQL support for PDO... yes, shared
checking for pg_config... not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path


そうきたか。
PostgreSQL は Mac 用のバイナリを本家のダウンロードページから持ってきてインストールしたからね。ヘッダとかないかも。

ヘッダファイルだけあればいいのかしら。

でも、ふと考えてアプリケーションフォルダを見るとゾウさんのマークがない。
あれ?

でも、ps ax 見ると postmaster も動いてるし、psql でバックエンドともちゃんとお話しができている。
なんぞこれ?

今動いてるプロセス止めて、関連ファイル(/Library/Postgresq/*)消して、バイナリ再インストールやってみるか。

というところまででいったん切る。

最新の画像もっと見る