[メモ]CentOS5.6のPHPをソース版に入れ替える

CentOS5.6にデフォルトでインストールされるPHPではなく、

必要最低限(?)のモジュールのみでコンパイルしたPHPに入れ替える必要があったので、

その手順をメモしておく。

 

【作業前バージョン】5.1.6

【作業後バージョン】5.2.17

 

■現状確認

# rpm -qa |grep php
php-5.1.6-27.el5_5.3
php-common-5.1.6-27.el5_5.3
php-cli-5.1.6-27.el5_5.3
php-ldap-5.1.6-27.el5_5.3

 

■デフォルトのPHPをアンインストール

# rpm -qa |grep php | xargs rpm -e

 

■必須パッケージのインストール

yum install libjpeg\*
yum install libpng\*
yum install libc-client\*
yum install libmcrypt\*
yum install mysql-devel
yum install php-pdo php-common

 

■PHPのソースをダウンロード

cd /usr/local/src
wget http://jp.php.net/get/php-5.2.17.tar.gz/from/this/mirror
tar zxvf php-5.2.17.tar.gz
cd php-5.2.17

 

■コンパイル

./configure \
--prefix=/usr/local \
--with-libdir=lib64 \
--with-mysql=/usr/bin/mysql \
--with-openssl \
--with-pear \
--enable-mbstring \
--enable-mbregex \
--enable-zend-multibyte \
--enable-sockets \
--with-apxs2=/usr/sbin/apxs \
--with-gd \
--with-zlib-dir=/usr \
--with-jpeg-dir=/usr \
--enable-ftp \
--enable-zip \
--with-iconv \
--with-imap \
--enable-mbstring \
--with-gd \
--enable-xmlreader \
--enable-xmlwriter \
--with-kerberos \
--with-imap-ssl \
--with-mcrypt \
--with-pdo-mysql=/usr/bin/mysql \
--with-mysqli=/usr/bin/mysql_config \
--enable-embedded-mysqli=/usr/bin/mysql \
--enable-calendar \
--with-curl
make
make test
make install

 

■php.iniの入れ替え

mv /etc/php.ini /etc/php.ini.20110903
cp php.ini-recommended /usr/local/lib/php.ini

 

■php.confの作成

cd /etc/httpd/conf.d
vi php.conf
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
 
LoadModule php5_module modules/libphp5.so
 
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
 
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
 
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
The following two tabs change content below.
しゃちょー

しゃちょー

有限会社こだまシステム社長。18歳の時からIT業界で働く。趣味はモータースポーツ。マイブームはダイエット。

関連記事

WEBアプリでファンクションキーを使う

 

ウイルスにご注意ください

年末から年始にかけて、コンピュータウイルスGumblar(ガンブラー)の被害が急速に拡大しています。
このウイルスの感染力はかなり強いと感じています。

クライアントプロセスが使うポート

サーバプロセスはポートを指定してListenしますが、クライアントプロセスはOSから動的に割り当てられます。
Windows的には一時ポートとか動的ポートといいますが、ネットワーク屋さん的にはエフェメラルポートといいます。

ベクトルの内積による相関係数の算出

CSVから$data[列][行]という2次元配列にいれたデータについて、1列目とその他の列とで相関係数を算出する。

ターミナルの任意の位置にechoする

シェルスクリプトを書いていると、「毎回20行目にフッタを表示させたい」なんてことがたまにあります。