Install php-5.3.0 on CentOS 5.3


Cent君でphpをインストールしたときのメモ
コンパイルオプションを修正した位かな
phpinfo()で確認&OCI-8については未確認
php.ini で date.timezone = 'Asia/Tokyo' を追加(--enable-calendarかな)

・Apache2のインストール
# yum -y install httpd
# yum -y install httpd-devel

・libmcrypt
# yum -y install libmcrypt
# yum -y install libmcrypt-devel

OpenLDAP
openldaphttpd と一緒にインストされます。
# yum -y install openldap
# yum -y install openldap-devel
# yum -y install openldap-clients

imap
# yum -y install libc-client
# yum -y install libc-client-devel
# yum -y install cyrus-sasl
# yum -y install cyrus-sasl-devel
# yum -y install cyrus-sasl-md5
# yum -y install cyrus-sasl-plain
# yum -y install cyrus-imapd
# yum -y install cyrus-imapd-devel
# yum -y install cyrus-imapd-utils

・Kerberos
PHPimapを使用する場合 Kerberos が必要です。
libc-client は require Kerberos なので(たぶん install 済み)
# yum -y install krb5-libs
# yum -y install krb5-workstation
# yum -y install krb5-auth-dialog
# yum -y install krb5-deve

・FreeTDS(for MS-SQL)
# yum -y install freetds
# yum -y install freetds-devel

・その他のパッケージ
# rpm -q bison 無い場合は # yum -y install bison
# rpm -q flex 無い場合は # yum -y install flex
# rpm -qa | grep libXpm 無い場合は # yum -y install xorg-x11-devel

・その他、必要に応じて以下を確認して下さい。
gd-devel
zlib-devel
freetype-devel
libxml2-devel
libjpeg-devel
libpng-devel
openssl-devel
libxslt-devel

Oracle instantclientのインストール
# unzip instantclient-basic-linux32-10.2.0.1-20050713.zip
# unzip instantclient-jdbc-linux32-10.2.0.1-20050713.zip
# unzip instantclient-sdk-linux32-10.2.0.1-20050713.zip
# unzip instantclient-sqlplus-linux32-10.2.0.1-20050713.zip
# mv instantclient_10_2 /usr/local

# cd /usr/local/instantclient_10_2
# ln -s libclntsh.so.10.1 libclntsh.so

適当な dir で以下を実行
# tar xvfz php-5.3.0.tar.gz
# ./configure 実行時の注意
changePerm.sh 適用済み : --with-oci8
詳細は以下を参照
http://otndnld.oracle.co.jp/tech/opensource/htdocs/php/inst_php_apache_linux/inst_php_apache_linux.html
./configure \
--with-libdir=lib64 \ # x_64 の場合追加:未確認(確認済)
--with-config-file-path=/usr/local/lib \
--with-apxs2=/usr/sbin/apxs \
--disable-ipv6 \
--with-libxml-dir=/usr \
--with-openssl \
--with-kerberos \
--with-zlib=/usr \
--with-bz2=/usr \
--enable-calendar \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-xsl \
--with-xpm-dir=/usr/X11R6/lib \
--with-xmlrpc \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--with-fdftk=/usr/local \
--enable-gd-jis-conv \
--with-gettext \
--with-imap=/usr \
--with-imap-ssl \
--with-ldap \
--with-ldap-sasl \
--enable-mbstring \
--enable-mbregex \
--with-mcrypt \
--with-mysql \
--with-pdo-mysql \
--with-mssql \
--with-pgsql=/usr/local/pgsql \
--with-pdo-pgsql=/usr/local/pgsql \
--with-unixODBC=/usr \
--enable-sysvshm \
--enable-soap \
--without-sqlite3 \
--without-pdo-sqlite \
--enable-ftp

# --with-oci8=instantclient,/usr/local/instantclient_10_2 \
# --with-pdo-oci=instantclient,/usr/local/instantclient_10_2,10.2.0.1 \
# --with-oci8 \
# --with-pdo-oci \

# make
# make install

/etc/httpd/conf/httpd.conf の編集
・以下の行を修正
LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
LoadModule php5_module modules/libphp5.so // 好みですね
追加
AddType application/x-httpd-php .phtml .php
AddType application/x-httpd-php-source .phps
以下の行を修正
AddDefaultCharset off // 好みですね

# cp php.ini-production /usr/local/lib/php.ini
/usr/local/lib/php.ini の編集 // 以下好みに応じて設定
allow_url_fopen = Off
default_charset = EUC-JP
register_globals = Off
log_errors = on
error_log = syslog
upload_tmp_dir = /var/tmp/apache/upload // 好みに応じて設定
upload_max_filesize = 2M // 好みに応じて設定
date.timezone = 'Asia/Tokyo'
session.save_path = /var/tmp/apache/session // 好みに応じて設定
output_handler = mb_output_handler
short_open_tag = On // <? ?> が有効

以下はXCVI. マルチバイト文字列関数 (mbstring)を参照
mbstring.language = Japanese
mbstring.internal_encoding = EUC-JP
mbstring.http_input = auto
mbstring.http_output = EUC-JP
mbstring.encoding_translation = On
mbstring.detect_order = auto

# service httpd restart

DocumentRoot に以下の内容でファイルを作成して内容を確認してください。
# cat phpinfo.php
<? phpinfo() ?>