PHP5のインストール

提供: Wikiducca
2019年1月10日 (木) 08:07時点における大沼 (ノート | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

CentOS5系 & Apache2.2系 & ソースからコンパイル の手順。


あらかじめ入れておくもの

  • libtool
  • libtool-ltdl
  • libtool-ltdl-devel
  • libmcrypt
  • libmcrypt-devel
  • libpng
  • libpng-devel

ダウンロード

http://jp.php.net/get/php-5.3.2.tar.gz/from/a/mirror この辺から拾ってくる。


configure オプション

./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--enable-mbstring \
--with-gd \
--enable-gd-native-ttf \
--with-png-dir=/usr \
--with-zlib \
--with-jpeg-dir=/usr \
--enable-ftp \
--with-mysql \
--enable-soap \
--with-libdir=lib64 \
--with-mcrypt \
--with-curl \
--with-openssl \
--with-mysqli

それぞれの意味は以下を参照。

http://php.net/manual/ja/configure.about.php

make & make install

# make 
# make test (必須ではない)
# make install


php.iniのコピー

※先にRPM 版の /etc/php.ini が残っていたら、削除 or リネームしておくこと。

# cp php.ini-production /usr/local/lib/php.ini


php.iniの編集

date.timezone = Asia/Tokyo

を設定する。


httpd.conf に以下を追記

LoadModule php5_module       modules/libphp5.so


対象となるディレクトリに以下を追記

AddType application/x-httpd-php .php
DirectoryIndex index.php index.html index.htm


以上で、Apache を再起動すれば、PHP が使えるようになっている。はず。