さくらインターネットにPHP5.2.1

上記に書いたみたいに、これはアプリにかなりの変更が必要になるので
いっそのことPHP5を使えるようにしてみる。

ここをたよりに
インストールしてみる。

# cd $HOME/local/src
# wget http://jp.php.net/get/php-5.2.1.tar.gz/from/this/mirror
# tar -xvzf php-5.2.1.tar.gz
# cd php-5.2.1

configureを実施する。

./configure \

    • prefix=$HOME \
    • with-config-file-path=$HOME/www/php5.ini \
    • program-suffix=5 \
    • with-pear=$HOME/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

あとはmake, make installするだけやねんけども
make installで問題発生。。。

Installing PEAR environment: /home/xxx/lib/php/
could not extract the package.xml file from "phar://install-pear-nozlib.phar/Console_Getopt-1.2.tar" Error while opening {/tmp/pear/cache/package.xml} in write binary mode
[PEAR] Console_Getopt: Cannot initialize 'phar://install-pear-nozlib.phar/Console_Getopt-1.2.tar', invalid or missing package file
could not extract the package.xml file from "phar://install-pear-nozlib.phar/Archive_Tar-1.3.2.tar" Error while opening {/tmp/pear/cache/package.xml} in write binary mode
[PEAR] Archive_Tar: Cannot initialize 'phar://install-pear-nozlib.phar/Archive_Tar-1.3.2.tar', invalid or missing package file
could not extract the package.xml file from "phar://install-pear-nozlib.phar/PEAR-1.4.11.tar" Error while opening {/tmp/pear/cache/package2.xml} in write binary mode
[PEAR] PEAR: Cannot initialize 'phar://install-pear-nozlib.phar/PEAR-1.4.11.tar', invalid or missing package file
Installing PDO headers: /home/xxx/include/php/ext/pdo/

なんでやねん、、、どっこもこんなつまづき書いてへんやん。。。
みんなうまいこといったって書いてるやん。。。

色々と調べてみるとPHP5.2.0から、PEAR環境変数を設定しやんかったら
デフォルトで/tmpを使おうとするらしいので、
レンタルサーバ用に、環境変数を設定する

vi $HOME/.cshrc

setenv PHP_PEAR_CACHE_DIR $HOME/share/pear5/cache

もう一回、make install。
OK、うまいこといった!!!

あとは、cgiとして起動させる設定を実施して
.htaccessに記述を追記すれば終了。

# mkdir -p $HOME/www/cgi-bin
# cp $HOME/bin/php5 $HOME/www/cgi-bin/php5.cgi

vi $HOME/.htaccess

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

OK!動いた!!!

ただし、$HOME/www/php5.iniに設定した設定ファイルを
ちゃんと読んでくれない。。。
phpinfo()にはちゃんと$HOME/www/php5.iniって出てるねんけど、
設定しても、まったく反映されず。。。

include_pathがSmartyで使用するのに使うねんけど、
反映されへんから、今回はデフォルトの場所にインストール。

ちなみにデフォルトの場所はconfigureで設定した
$HOME/share/pear5になってた。

これの調査はおいおい。。。
とりあえず、全部PHP5で動いた!!!

何か久しぶりの達成感やな。。。。