2010年7月4日日曜日

PHP5.2.9 インストールメモ

■PHPインストール先のディレクトリ作成
[root@tanyao-web02 ~]# mkdir /opt/php5


■libiconvのインストール(文字コード対応に必要っぽい。)
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz からモジュールをダウンロード
[root@tanyao-web02 library_20100129]# tar -zxf libiconv-1.13.1.tar.gz
[root@tanyao-web02 library_20100129]# cd libiconv-1.13.1
[root@tanyao-web02 libiconv-1.13.1]# ./configure --prefix=/opt/php5/local
[root@tanyao-web02 libiconv-1.13.1]# make
[root@tanyao-web02 libiconv-1.13.1]# make install


■libmcryptのインストール
http://sourceforge.net/projects/mcrypt/ にてlibmcrypt-2.5.8.tar.gzをダウンロード
[root@tanyao-web02 library_20100129]# tar -zxf libmcrypt-2.5.8.tar.gz
[root@tanyao-web02 library_20100129]# cd libmcrypt-2.5.8
[root@tanyao-web02 libmcrypt-2.5.8]# ./configure --prefix=/opt/php5/mcrypt
[root@tanyao-web02 libmcrypt-2.5.8]# make
[root@tanyao-web02 libmcrypt-2.5.8]# make install


■php5本体のインストール
[root@tanyao-web02 ~]# cd /home/operation/src/php5/
[root@tanyao-web02 php5]# tar -zxf php-5.2.9.tar.gz
[root@tanyao-web02 php5]# cd php-5.2.9
[root@tanyao-web02 php-5.2.9]# ./configure \
> --prefix=/opt/php5 \
> --with-nsapi=/opt/sjsws \
> --with-libxml-dir=/usr/lib \
> --with-cdb \
> --with-gd \
> --with-jpeg-dir=/usr/lib \
> --with-png-dir=/usr/lib \
> --with-zlib \
> --with-freetype-dir=/usr/lib \
> --with-mcrypt=/opt/php5/mcrypt \
> --with-pear=/opt/php5/lib/php \
> --without-mysql \
> --enable-libgcc \
> --enable-mbstring \
> --enable-mbregex \
> --enable-zend-multibyte \
> --enable-sigchild \
> --disable-pdo

最後に下記が表示される
+--------------------------------------------------------------------+
License:
This software is subject to the PHP License, available in this
distribution in the file LICENSE. By continuing this installation
process, you are bound by the terms of this license agreement.
If you do not agree with the terms of this license, you must abort
the installation process at this point.
+--------------------------------------------------------------------+

Thank you for using PHP.

[root@tanyao-web02 php-5.2.9]# make ←5分くらいはかかる
[root@tanyao-web02 php-5.2.9]# make install
Installing PHP SAPI module: nsapi
Installing PHP CLI binary: /opt/php5/bin/
Installing PHP CLI man page: /opt/php5/man/man1/
Installing build environment: /opt/php5/lib/php/build/
Installing header files: /opt/php5/include/php/
Installing helper programs: /opt/php5/bin/
program: phpize
program: php-config
Installing man pages: /opt/php5/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /opt/php5/lib/php/
[PEAR] Console_Getopt - installed: 1.2.3
[PEAR] Archive_Tar - installed: 1.3.2
[PEAR] Structures_Graph- installed: 1.0.2
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
[PEAR] PEAR - installed: 1.7.2
Wrote PEAR system config file at: /opt/php5/etc/pear.conf
You may want to add: /opt/php5/lib/php to your php.ini include_path


--- SunJavaWebServerのconfigファイル群の編集 ---
[root@tanyao-web02 ~]# cd /opt/sjsws/https-tanyao-web02.tanyao.net/config

■mime.types
[root@tanyao-web02 config]# cp mime.types mime.types.20100130
[root@tanyao-web02 config]# vi mime.types
→145行目あたりに追加
type=magnus-internal/x-httpd-php exts=php


■magnus.conf
[root@tanyao-web02 config]# cp magnus.conf magnus.conf.20100130
[root@tanyao-web02 config]# vi magnus.conf

→17行目と18行目の間あたりに下記2行を追加 ★これを有効化するとWebサーバが起動エラー!!!
Init fn="load-modules" funcs="php5_init,php4_execute,php5_auth_trans" shlib="/opt/sjsws/bin/libphp5.so"
Init fn="php5_init" LateInit="yes" errorString="Failed to initialize PHP!"

■obj.conf
[root@tanyao-web02 config]# cp obj.conf obj.conf.20100130
[root@tanyao-web02 config]# vi obj.conf
---
Service method="TRACE" fn="service-trace"
Service fn="php5_execute" type="magnus-internal/x-httpd-php" ←追加
Error fn="error-j2ee"