PHPをインストールしました。yumだとバージョンが古くなるのでソースからインストール。


1.必要なパッケージのインストール

   # yum -y install libxml2
   # yum -y install libxml2-devel
   # yum -y install gd
   # yum -y install gd-devel
   # yum -y install zlib
   # yum -y install zlib-devel
   # yum -y install libjpeg
   # yum -y install libjpeg-devel
   # yum -y install libpng
   # yum -y install libpng-devel
   # yum -y install freetype
   # yum -y install freetype-devel

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


2.tarボールをダウンロードして解凍

  tar xvfz php-5.2.14.tar.gz


3.Makefileの作成

   cd /usr/local/src/php-5.2.1

(初回でない場合はmake distclean)

./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-pear \
--with-pgsql \
--with-mysql \
--enable-mbstring \
--with-zlib \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-mcrypt \
--with-libdir=lib64


4.コンパイル

   make


5.コンパイル確認

   make test


   なんかfailedとなっているが無視

   =====================================================================
   EXPECTED FAILED TEST SUMMARY
   ---------------------------------------------------------------------
   output buffering - fatalism [tests/output/ob_011.phpt]
   ob_start(): Ensure unerasable buffer cannot be flushed by ob_flush()       [tests/output/ob_start_basic_unerasable_005.phpt]
   SPL: ArrayObject::exchangeArray() basic usage with object as underlying data store.  [ext/spl/tests/arrayObject_exchangeArray_basic3.phpt]
   Bug #39863 (file_exists() silently truncates after a null byte) [ext/standard/tests/file/bug39863.phpt]
   =====================================================================


6.インストール

   make install


7.apache2.2に設定を追加

   vi /usr/local/apache2/bin/httpd.con #httpd.confを開く

   ドキュメントルートの変更

   #DocumentRoot "/usr/local/apache2/htdocs"

   DocumentRoot "/home/public_html"

   文末に以下の記述を追記

   <Directory "/home/public_html">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

   </Directory>


   <FilesMatch \.php$>

    SetHandler application/x-httpd-php

   </FilesMatch>


8.アクセス確認

  ドキュメントルートにphpinfoを設置

  http://localhost/phpinfo.php

  でアクセス⇒OK!