さくら(sakura)にphp5をインストール

php-5.2.3.tar.gzをインストール
※$HOME→/home/[MYアカウント]

$HOME/src/で解凍

configureオプションを付けて実行
%./configure –prefix=$HOME/local/php5 –with-config-file-path=$HOME/www/cgi-bin –program-suffix=5 –with-pear=$HOME/local/php5/pear –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-calendar –with-iconv=/usr/local

make

makeinstall

cgi-bin生成 mkdir $HOME/www/cgi-bin/

ln php-cgi5 $HOME/www/cgi-bin/php5.cgi
※symlinkじゃなくてハードリンク

/www/の下に.htaccessを登録
拡張子php5の場合
Action php5-script /cgi-bin/php5.cgi
AddHandler php5-script .php5

拡張子phpの場合
Action php5-script /cgi-bin/php5.cgi
AddHandler php5-script .php

サブドメイン毎に設定
ln $HOME/local/php5/bin/php-cgi5 $HOME/www/サブドメインディレクトリ/cgi-bin/php5.cgi

php.iniを作るなら、php5.cgiがある場所にphp.iniを作成

phpリファレンス