CentOS
PHP4.4.1をCentOS5.3にソースからインストールした
PHP4の環境を作る必要があったときのメモ
追記
トラックバックにてご指摘を頂きました。
http://d.hatena.ne.jp/elf/20090716/1247719991#c
いくつか不備のあるところがあります。
4.4.1の
作業フォルダを作って移動
mkdir src cd src/
ソースのダウンロード
wget ftp://ftp.polytechnic.edu.na/pub/openpkg/sources/DST/apache/php-4.4.1.tar.gz
解凍
tar xvfz php-4.4.1.tar.gz
フォルダに移動
cd ../php-4.4.1
configureの設定
./configure --with-apxs=/usr/local/apache/bin/apxs --with-pgsql=/usr/local/pgsql --enable-mbstring --enable-mbregex
ここで以下のエラーメッセージが発生
checking lex output file root... ./configure: line 2426: lex: command not found
configure: error: cannot find output from lex; giving up
phpのコンパイルにflexが必要とのこと
参考サイト
http://74.125.153.132/search?q=cache:T6Rh30hArNQJ:www.databasebank.com/programmers/frm_detail.php%3Fv_id%3D1992+%22lex:+command+not+found%22&cd=1&hl=ja&ct=clnk&gl=jp&lr=lang_ja&client=firefox-a
参考サイトにはbisonも必要とあるが、今回はflexだけで通った。深くは追及してない
flexをインストール
yum install flex
改めてconfigureの設定
./configure --with-apxs=/usr/local/apache/bin/apxs --with-pgsql=/usr/local/pgsql --enable-mbstring --enable-mbregex
今度は以下のエラーが発生
checking for pg_config... not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
参考サイト
http://www.aconus.com/~oyaji/bbs/past/0004/B0002557.html
postgresql-develが入っていないかららしい。
yum search postgresqlで以下のものを発見したのでそれをいれる
postgresql-devel.i386 7.4.19-1.el4_6.1 base
yum install postgresql-devel
もう一回挑戦configureの設定
./configure --with-apxs=/usr/local/apache/bin/apxs --with-pgsql=/usr/local/pgsql --enable-mbstring --enable-mbregex
- +
*** WARNING *** You chose to compile PHP with the built-in MySQL support. If you are compiling a server module, and intend to use other server modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, mod_perl) you must NOT rely on PHP's built-in MySQL support, and instead build it with your local MySQL support files, by adding --with-mysql=/path/to/mysql to your configure line.
- +
License: This software is subject to the PHP License, available in this distribution in the file LICENSE. By continuing this installation process, you are bound by the terms of this license agreement. If you do not agree with the terms of this license, you must abort the installation process at this point.
- +
*** NOTE *** The default for register_globals is now OFF! If your application relies on register_globals being ON, you should explicitly set it to on in your php.ini file. Note that you are strongly encouraged to read http://www.php.net/manual/en/security.globals.php about the implications of having register_globals set to on, and avoid using it if possible.
- +
Thank you for using PHP.
通った
make
make
install
make install
とりあえずインデックスの構築
updatedb
ドキュメントルートに移動
cd /usr/local/apache/htdocs/
viを起動してテストファイルの作成
<?php phpinfo() ?>
php.iniの作成(コピー)
cd /tmp/src/php-4.4.1/ cp php.ini-dist /usr/local/pgsql/lib/php/.ini
locate httpd.conf
/usr/local/apache/conf/httpd.conf.default
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/httpd.conf.bak
/etc/httpd/conf/httpd.conf.rpmsave
/usr/local/apache/conf/httpd.conf.bakはたぶんhttpdを再インストールする前のもの
編集
cd /usr/local/apache/conf/ vi httpd.conf
末尾に下記を追加
AddType application/x-httpd-php .php .phtml
Apache再起動
./apachectl stop ./apachectl start