RedHat9にphp4.3.8をインストールする

PHPのインストールについて

RedHat9にphp4.3.8をインストールしてみる。
標準では4.2.2がインストールされているが、マルチバイトの動作がなんかおかしい?


いろいろとrpmファイルを検索してインストールしてみたけど動かない。
なのでソースからインストールすることに。



httpd-develがインストールされているか確認。なければインストールする。
phpをソースからインストールする際、apacheの動的共有モジュール(DSO)とする為?)
なければ、RPM SEARCHなどで適当に探す http://rpm.pbone.net/



次にphpのソースファイルをダウンロード。
http://www.php.net/downloads.php



適当なフォルダに解凍して./configuerを実行。

./configuer \
>--with-apxs2filter=/usr/sbin/apxs \  (DSO用 apxsへのパスを指定。httpd-develをインストールしないとapxsファイルはない)
>--enable-mbstring \          (マルチバイト対応)
>--enable-mbstr-enc-trans \      
>--enable-mbregex \          (マルチバイトの正規表現)
>--enable-zend-multibyte         (PHPスクリプトがShift_JISで記述可能になる)

正常終了したらmake,make installを実行する


続いて解凍したソースファイルのディレクトリにあるphp.ini-distファイルを/usr/local/lib/php.iniにコピー


コピーしたphp.iniの設定を変更する

output_buffering = On
output_handler = mb_output_handler
[mbstring]
mbstring.language = Japanese
mbstring.internal_encoding = EUC-JP
mbstring.http_input = auto
mbstring.http_output = EUC-JP
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.substitute_character = none;
mbstring.func_overload = 0
mbstring.script_encoding = auto


最後にapacheの設定を変更する /etc/httpd/conf/httpd.conf

LoadModule php4_module modules/libphp4.so

AddType application/x-httpd-php .php

DirectoryIndex index.html index.php

設定が終了したら、apachemysqlを再起動。
/etc/rc.d/init.d/httpd restart
/etc/rc.d/init.d/mysqld restart



phpの動作は

<?php
infophp();
?>

ってな内容のファイルを作ってアクセスする。
phpの設定内容の画面が表示されればOKです。


参考URL http://www.dolphy.gr.jp/webap/env/php-install.html

上記ページではgd関係のオプションを指定しているが、うちの環境ではgdを有効化すると
configが正常終了しませんでした。