PHPをコンパイルするときのコンフィグオプション。 さくらインターネットの場合は大抵のものは入ってるし、CGIとして入れるんだけど自宅でやるならApacheモジュールとして入れたほうが動作が速いし。 Oracleと連携させる状態にしてみたり、GDと戦ってみたり。 とりあえずオプションだけ書いておく
./configure --prefix=/usr/pkg/php5 --with-apxs2=/usr/hoge/apache/bin/apxs --enable-mbstring --enable-memory-limit --enable-zend-multibyte --enable-mbregex --enable-mbstr-enc-trans --with-pear --with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib --with-gettext --with-xmlrpc --with-libxml2-dusr=/usr/lib/ --with-xsl=/usr/lib/ --with-inifile --with-gd --with-mysql=/usr/pkg/mysql/ --with-zlib-dusr=/usr/pkg/php5 --with-jpeg-dusr=/usr/pkg/php5 --with-png-dusr=/usr/pkg/php5 --with-freetype-dusr=/usr/pkg/php5 --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl=/usr --enable-pdo --with-pdo-oci=instantclient,/usr,10.2.0.3 --enable-sigchild
#!/bin/sh
phpVersion=php-5.2.1
#phpVersion=php-5.2.2RC1
#バイナリをダウンロードするホスト
downloadHost=http://downloads.php.net/ilia
# パスを入力しなかった場合に使用されるインストールディレクトリ
defaultInstallDirPath=$HOME/php
workDir=`pwd`
workLogDir=$workDir/log
#ログディレクトリがなければ作成する
if [ ! -d "${workLogDir}" ];
then
mkdir -p ${workLogDir}
fi
if [ -f "${workLogDir}/installDir.log" ];
then
installDirPath=`cat ${workLogDir}/installDir.log`
else
# インストールするディレクトリを聞く
echo "please input install dir path. (default ${defaultInstallDirPath})"
read installDirPath
if [ -z "$installDirPath" ];
then
installDirPath=${defaultInstallDirPath}
fi
# インストールディレクトリのパスをログに残す
echo ${installDirPath} > ${workLogDir}/installDir.log
fi
PHP_PEAR_CACHE_DIR=${installDirPath}/tmp/pear/cache
export PHP_PEAR_CACHE_DIR
#ディレクトリがなければ作成する
if [ ! -d "${phpVersion}" ];
then
mkdir -p ${installDirPath}/tmp
fi
cd ${installDirPath}/tmp
# 引数にclearが渡されたなら、一時ディレクトリとバイナリを削除する
# またpearもclear-cacheする
if [ "$1" = "clear" ];
then
rm -f ${phpVersion}.tar.gz
rm -rf ${phpVersion}
${installDirPath}/bin/pear clear-cache
echo "clear finish."
exit
fi
# ファイルがあればそれを使い、ない場合はオンラインから取得する
if [ -f "${phpVersion}.tar.gz" ];
then
echo "'${phpVersion}.tar.gz' is already exist."
else
wget ${downloadHost}/${phpVersion}.tar.gz
fi
#ディレクトリが展開されていない場合展開する
if [ -d "${phpVersion}" ];
then
echo "'${phpVersion}' is already exist."
else
tar -zxvf ${phpVersion}.tar.gz
fi
cd ${phpVersion}
# PHPのconfigureを走らせる
./configure \
--prefix=${installDirPath} \
--with-pear \
--disable-url-fopen-wrapper \
\
\
--with-config-file-path=".:${installDirPath}/lib" \
--enable-magic-quotes=no\
--disable-short-tags\
\
\
--enable-force-cgi-redirect \
--enable-discard-path \
\
\
--with-zlib=/usr \
\
--enable-exif \
--with-gd=/usr/local \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-ttf \
--with-freetype-dir=/usr \
\
--enable-mbstring=all \
--enable-mbregex \
--enable-mbstr-enc-trans \
--enable-zend-multibyte \
\
--with-mysql \
--enable-pdo \
--with-pdo-mysql \
--with-openssl=/usr \
--with-curl \
\
--with-xml \
--with-xmlrpc \
--with-xsl \
\
--with-inifile \
\
| tee ${workLogDir}/configure.log
isMake=""
#while [ $isMake != "" ]
#do
echo "If you want to 'make' and 'make install', you input 'y'"
read isMake
#done
if [ "$isMake" = "y" ];
then
make | tee ${workLogDir}/make.log
make install | tee ${workLogDir}/make_install.log
fi
echo "finish."
シェルにしてみるというジョークww