YAMAGUCHI::weblog

海水パンツとゴーグルで、巨万の富を築きました。カリブの怪物、フリーアルバイター瞳です。

PHP5.1.xにSQLiteモジュールをインストールする

プロキシ使わないといけないのでその設定。

# pear config_set http_proxy http://<host>.<domain>:<port>/

pecl使ってインストール。

# pecl install SQLite
Password:
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update
/tmp/glibctestBuZiYK:1:22: features.h: No such file or directory
downloading SQLite-1.0.3.tgz ...
Starting to download SQLite-1.0.3.tgz (371,189 bytes)
............................................................................done: 371,189 bytes
50 source files, building
running: phpize
Cannot find build files at '/usr/lib/build'. Please check your PHP installation.

ERROR: `phpize' failed

phpizeを入れてないことが発覚したので、インストール。

# yum install php-devel

改めてインストール。

# pecl install SQLite
(略)
/tmp/tmpGktWbN/SQLite-1.0.3/sqlite.c:56: error: 'BYREF_NONE' undeclared here (not in a function)
/tmp/tmpGktWbN/SQLite-1.0.3/sqlite.c:56: error: 'BYREF_FORCE' undeclared here (not in a function)
/tmp/tmpGktWbN/SQLite-1.0.3/sqlite.c:125: warning: initialization from incompatible pointer type
/tmp/tmpGktWbN/SQLite-1.0.3/sqlite.c:126: warning: initialization from incompatible pointer type
make: *** [sqlite.lo] エラー 1
ERROR: `make' failed

調べてみるとどうやらRedHat系のディストリビューションだとこの手のエラーがちょいちょい起きてるっぽい。まあソースを修正するんだろうなあとか思ってたら同様のことをしている人がいたので実行。

# pecl download SQLite
# tar xzf SQLite-1.0.3.tgz
# phpize
# ./configure --configure=/usr/lib/php/modules
# vi sqlite.c
@line56 - static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
@line56 + /* static unsigned char arg3_force_ref[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; */

@line125 - PHP_FE(sqlite_open, arg3_force_ref) 
@line125 + PHP_FE(sqlite_open, third_arg_force_ref)
@line126 - PHP_FE(sqlite_popen, arg3_force_ref)
@line126 + PHP_FE(sqlite_popen, third_arg_force_ref) 
# make && make install

インストール完了。