VineLinux3.x/Apache2.0/PHP4のインストール のバックアップ差分(No.7)


  • 追加された行はこの色です。
  • 削除された行はこの色です。
* 概要 [#xa4e07d2]

PHP(Hypertext Preprocessor)
PHP(Hypertext Preprocessor)4をソースからインストールします

PHP4をソースからインストールします

** ダウンロード、解凍 [#c0b4b890]

 # wget http://jp2.php.net/distributions/php-4.3.11.tar.gz
 --16:07:07--  http://jp2.php.net/distributions/php-4.3.11.tar.gz
            => `php-4.3.11.tar.gz'
 jp2.php.net をDNSに問いあわせています... 210.138.109.182
 jp2.php.net[210.138.109.182]:80 に接続しています... 接続しました。
 HTTP による接続要求を送信しました、応答を待っています... 200 OK
 長さ: 4,875,262 [application/x-tar]
 
 100%[==============================================>] 4,875,262    766.64K/s    ETA 00:00
 
 16:07:13 (871.71 KB/s) - `php-4.3.11.tar.gz' を保存しました [4875262/4875262]
 
 # tar zxf php-4.3.11.tar.gz 
 # cd php-4.3.11


** configureの前にインストールが必要だと思われるパッケージ [#j39be026]

 # apt-get install flex \
 bzip2-devel \
 libmcrypt libmcrypt-devel \
 MySQL-server MySQL-devel \
 ncurses ncurses-devel \
 openssl-devel \
 libjpeg-devel zlib-devel libpng-devel \
 t1lib-devel \
 imap imap-devel \
 openldap openldap-devel \
 db4-devel

 パッケージリストを読みこんでいます... 完了
 依存情報ツリーを作成しています... 完了
 * MySQL-server は既に最新バージョンがインストールされています。
 * ncurses は既に最新バージョンがインストールされています。
 * openssl-devel は既に最新バージョンがインストールされています。
 以下の追加パッケージがインストールされます:
   t1lib
 以下のパッケージが新たにインストールされます:
   MySQL-devel bzip2-devel db4-devel flex imap imap-devel libjpeg-devel libmcrypt
   libmcrypt-devel libpng-devel ncurses-devel openldap openldap-devel t1lib t1lib-devel
   zlib-devel
 アップグレード: 0 個, 新規インストール: 16 個, 削除: 0 個, 保留: 1 個
 17.9MB のアーカイブを取得する必要があります。
 展開後に 45.5MB のディスク容量が追加消費されます。
 続行しますか? [Y/n]y
 取得:1 http://updates.vinelinux.org 3.1/i386/plus libmcrypt 2.5.7-1vl2 [73.3kB]
 取得:2 http://updates.vinelinux.org 3.1/i386/plus openldap 2.1.30-0vl1 [581kB]
 取得:3 http://updates.vinelinux.org 3.1/i386/main t1lib 1:5.0.2-0vl1 [162kB]
 取得:4 http://updates.vinelinux.org 3.1/i386/plus MySQL-devel 4.0.23-0vl0 [930kB]
 取得:5 http://updates.vinelinux.org 3.1/i386/devel bzip2-devel 1.0.2-0vl2 [36.9kB]
 取得:6 http://updates.vinelinux.org 3.1/i386/updates db4-devel 4.2.52-6vl3.1 [1961kB]
 取得:7 http://updates.vinelinux.org 3.1/i386/plus flex 2.5.4a-30vl1 [119kB]
 取得:8 http://updates.vinelinux.org 3.1/i386/plus imap 1:2001a-10vl3 [1155kB]
 取得:9 http://updates.vinelinux.org 3.1/i386/plus imap-devel 1:2001a-10vl3 [1229kB]
 取得:10 http://updates.vinelinux.org 3.1/i386/devel libjpeg-devel 6b-21vl2 [167kB]
 取得:11 http://updates.vinelinux.org 3.1/i386/plus libmcrypt-devel 2.5.7-1vl2 [33.9kB]
 取得:12 http://updates.vinelinux.org 3.1/i386/devel zlib-devel 1.1.4-0vl3 [64.4kB]
 取得:13 http://updates.vinelinux.org 3.1/i386/updates libpng-devel 2:1.2.8-0vl1 [174kB]
 取得:14 http://updates.vinelinux.org 3.1/i386/devel ncurses-devel 5.4-0vl2 [10.0MB]
 取得:15 http://updates.vinelinux.org 3.1/i386/plus openldap-devel 2.1.30-0vl1 [536kB]
 取得:16 http://updates.vinelinux.org 3.1/i386/devel t1lib-devel 1:5.0.2-0vl1 [624kB]
 17.9MB を 20s 秒で取得しました (879kB/s)
 変更を適用しています...
 Preparing...                ########################################### [100%]
    1:libmcrypt              ########################################### [  6%]
    2:openldap               ########################################### [ 12%]
    3:t1lib                  ########################################### [ 18%]
    4:MySQL-devel            ########################################### [ 25%]
    5:bzip2-devel            ########################################### [ 31%]
    6:db4-devel              ########################################### [ 37%]
    7:flex                   ########################################### [ 43%]
    8:imap                   ########################################### [ 50%]
    9:imap-devel             ########################################### [ 56%]
   10:libjpeg-devel          ########################################### [ 62%]
   11:libmcrypt-devel        ########################################### [ 68%]
   12:zlib-devel             ########################################### [ 75%]
   13:libpng-devel           ########################################### [ 81%]
   14:ncurses-devel          ########################################### [ 87%]
   15:openldap-devel         ########################################### [ 93%]
   16:t1lib-devel            ########################################### [100%]
 完了



** apache2(マルチスレッド対応)とmysqlを使う場合に必要十分だと思われるオプション例 [#jd46f0e0]

 # ./configure \
 --enable-bcmath \
 --enable-calendar \
 --enable-dio \
 --enable-exif \
 --enable-ftp \
 --enable-mbregex \
 --enable-mbstring \
 --enable-pcntl \
 --enable-roxen-zts \
 --enable-shmop \
 --enable-sockets \
 --enable-sysvmsg \
 --enable-sysvsem \
 --enable-sysvshm \
 --enable-wddx \
 --enable-zend-multibyte \
 --prefix=/usr \
 --with-apxs2=/usr/local/apache2/bin/apxs \
 --with-bz2 \
 --with-config-file-path=/etc \
 --with-gettext \
 --with-iconv \
 --with-libmbfl \
 --with-mcrypt \
 --with-mime-magic \
 --with-mod_charset \
 --with-mysql=/usr \
 --with-ncurses \
 --with-openssl \
 --with-gd --with-jpeg-dir=/usr --with-zlib-dir=/usr \
 --enable-gd-jis-conv \
 --enable-gd-native-ttf \
 --with-t1lib \
 --with-ttf \
 --with-ldap \
 --enable-dba \
 --with-db4 \
 --with-flatfile \
 --with-inifile

 +--------------------------------------------------------------------+
 | 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.                            |
 +--------------------------------------------------------------------+
 |                          *** NOTE ***                              |
 |            The default for register_globals is now OFF!            |
 |                                                                    |
 | If your application relies on register_globals being ON, you       |
 | should explicitly set it to on in your php.ini file.               |
 | Note that you are strongly encouraged to read                      |
 | http://www.php.net/manual/en/security.globals.php                  |
 | about the implications of having register_globals set to on, and   |
 | avoid using it if possible.                                        |
 +--------------------------------------------------------------------+
 
 Thank you for using PHP.

が出ればOKだす。

 # make
 # make install


php.iniをコピー
 # cp php.ini-dist /etc/php.ini


** /etc/php.iniの編集 [#b881331d]
 # vi /etc/php.ini

>
 output_buffering	 = On
 
 output_handler		 = mb_output_handler
 
 magic_quotes_gpc = Off

以下は、設定しなくてもよいです。PHPのソースがEUC-JPで出力をEUC-JPに固定したい場合のみ、設定すればいいと思います。Shift_JISなどで書かれたPHPを一緒に動かす場合は文字化けします。
 
 default_charset 	 = EUC-JP
  
 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
 mbstring.substitute_character = none


** apache2の再起動 [#e0624624]

 # /etc/rc.d/init.d/apache2 restart
 httpdを停止中:                                             [  OK  ]
 httpdを起動中:                                             [  OK  ]


** 動作確認 [#h01b6658]

apacheのDocumentRootとして指定しているディレクトリ以下にinfo.phpを作成

 # vi /home/httpd/html/info.php

>
に、

 <?php phpinfo() ?>

と記述して保存。

クライアントより、

 http://xxxxxx/info.php

で表示されれば完了。

確認が終わったら、info.phpは削除すること。


* コメント [#v252f82d]
#pcomment(PHP/コメント)