php版本:5.3.13

php安装依赖包:yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpef-devel freetype-devel libpng-devel gd-devel curl-devel libxslt libxslt-devel openssl-devel -y

还需要libiconv包

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar zxvf libiconv-1.14.tar.gz

./configutr --prefix=/usr/local/libiconv

--------------------------------------------------------------

编译安装php:

./configure --prefix=/usr/local/php

--with-apxs2=/usr/local/apache/bin/apxs

--with-mysql=/usr/local/mysql

--with-xmlrpc

--with-openssl

--with-zlib

--with-freetype-dir

--with-gd

--with-jpeg-dir

--with-png-dir

 --with-iconv=/usr/local/libiconv

--enable-short-tags

--enable-sockets

--enable-zend-multibyte

--enable-soap

--enable-mbstring

--enable-static

--enable-gd-native-ttf

--with-curl

--with-xsl

--enable-ftp

--with-libxml-dir

 适合nagios的php环境 解决msn robot “Call to undefined function pdntl_fork()”报错而加

--enable-sigchild

--enable-pcntl

--enable-bcmath

(方便复制:./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-xmlrpc --with-openssl --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir --with-iconv=/usr/local/libiconv --enable-short-tags --enable-sockets --enable-zend-multibyte --enable-soap --enable-mbstring --enable-static --enable-gd-native-ttf --with-curl --with-xsl --with-libxml-dir --enable-ftp --enable-sigchild --enable-pcntl --enable-bcmath)

编译安装完成后 需要到 apache的配置文件里面指定php首页

再到配置文件的311行左右添加

AddType application/x-httpd-php .php .php3

AddType application/x-httpd-php-source .phps 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~