さくらのレンタルサーバでPHP5

さくらのレンタルサーバでPHP5を参考に、php5をインストール。


うちの環境用に、configureのディレクトリパスだけを書き換えた。

$ ./configure -prefix=$HOME/local -with-config-file-path=$HOME/var/php5.ini -program-suffix=5 -with-pear=$HOME/local/share/pear5 -enable-force-cgi-redirect -enable-mbstring=all -enable-mbregex -enable-mbstr-enc-trans -enable-versioning -enable-trans-sid -with-mysql -with-openssl=/usr -with-soap=yes -with-zlib=/usr -with-gd=/usr/local -with-jpeg-dir=/usr -with-freetype-dir=/usr -with-ttf -with-png-dir=/usr -with-curl -enable-sqlite-utf8
$ make
$ make install

インストールされたphp5を~/www/cgi-bin/php5.cgiとしてコピーし、

cp ~/local/bin/php5 ~/www/cgi-bin/php5.cgi

.haccess に下記のように記述。

Action php5-script /cgi-bin/php5.cgi
AddHandler php5-script .php5

これで拡張子が .php5 のスクリプトはphp5で動くようになった。


下記スクリプトでも確認。
phpのパージョンはきっちり5になっていた。

info.php5
<?php phpinfo(); ?>