一、实验环境
环境:CentOS6.5
软件:php-5.3.27.tar.gz
二、实验步骤
1.PHP安装准备
1)安装php所依赖的包zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel
yum -y install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel
2)检查是否都已经安装上
rpm -qa zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel
3)安装libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
4)安装libmcrypt库 ,在此采用的是按章epel源方法来安装libmcrypt包
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum -y install libmcrypt
5)安装mcypt加密扩展库
yum -y install mcrypt
6)安装mhash加密算法
yum -y install mhash
7)安装libxslt-devel
yum -y install libxslt-devel
2.开始安装PHP服务
1)下载php-5.3.37.tar.gz,并解压 。
tar xf php-5.3.27.tar.gz
2)编译安装php-5.3.27
cd php-5.3.27
./configure \
--prefix=/application/php-5.3.27 \
--with-mysql=/application/mysql \
--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-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curlwrappers \
--enable-mbregex \
--enable-mbstring \
--enable-fpm \
--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 \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp
注意:在make前加上这两条命令:
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar
make && make install
ln -s /application/php-5.3.27/ /application/php/
3)配置php解析配置文件
cp php.ini-production /application/php/lib/php.ini
cp php-fpm.conf.default ./php-fpm.conf
4)启动php进程
/application/php/sbin/php-fpm
lsof -i :9000
5) 在nginx站点目录下写一个test_phpinfo.php代码测试php
<?php
phpinfo();
?>
6)输入域名进行访问,得到结果如下图:
本文转自chengong1013 51CTO博客,原文链接:http://blog.51cto.com/purify/1790734,如需转载请自行联系原作者