安装php需要的软件。
yum �Cy
install gcc gcc-c++ libxml2 libxml2-devel libiconv libjpeg libjpeg-devel libpng libpng-d
evel gdgd-devel bzip2 bzip2-devel curl curl-devel freetype freetype-devel zlib zlib-develglibc glibc-devel glib2 glib2-devel
libtool-ltdl-devellibtool-ltdl pcre pcre-devel
安装libiconv库
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
cd ..
安装libmcrypt
tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install
cd libltdl/
./configure �Cenable-ltdl-install
make && make install
cd ..
安装mhash加密扩展库
tar zxf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make && make install
####################################
安装PHP
cd /home/darren/tools
wgethttp://php.net/get/php-5.6.20.tar.gz/from/a/mirror
tar zxf php-5.3.27.tar.gz
cd php-5.3.27
�Cwith-mysql=/application/mysql/ 数据库不在本地时,换成以下参数
./configure \
-with-mysql=mysqlnd \
-prefix=/application/php \
-with-iconv-dir=/usr/local/libiconv \
-with-freetype-dir \
-with-jpeg-dir \
-with-png-dir \
-with-zlib \
-with-libxml-dir=/usr \
-enable-xml \
-disable-rpath \
-enable-safe-mode \
-enable-enable-shmop \
-enable-sysvsem \
-enable-inline-optimization \
-with-curl \
-with-curlwrappers \
-enable-mbregex \
-enable-mbstring \
-with-mcrypt \
-with-gd \
-enable-gd-native-ttf \
-with-openssl \
-with-mhash \
-enable-pcntl \
-enable-sockets \
-with-xmlrpc \
-enable-zip \
-enable-soap \
-enable-short-tags \
-enable-zend-multibyte \
-enable-static \
-with-xsl \
-enable-ftp\
-enable-fpm \
-with-fpm-user=nginx \
-with-fpm-group=nginx
make && make install
#################################################
ln -s /application/php5.3.27//application/php
复制php配置文件php.ini
cp/application/tools/php-5.3.27/php.ini-production
/application/php/lib/php.ini
复制fastcgi配置文件php-fpm.conf
cp/application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf
/application/php/sbin/php-fpm -t #检查语法
/application/php/sbin/php-fpm #启动php-fpm
#######################################################
附另一个生产环境编译参数:
./configure --prefix=/usr/local/php \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-mcrypt \
--with-curlwrappers \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear