1、安装依赖包
[root@linux application]# yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y
[root@linux application]# yum install freetype-devel libpng-devel gd-devel libcurl-devel livxslt-devel libxslt-devel -y
[root@linux php-5.3.27]# yum install libtool-ltdl-devel
[root@linux tools]# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
[root@linux tools]# tar zxf libiconv-1.14.tar.gz
[root@linux tools]# cd libiconv-1.14
[root@linux tools]# ./configure --prefix=/usr/local/libiconv
[root@linux tools]# make
[root@linux tools]# make install
[root@linux tools]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
[root@linux tools]# yum -y install libmcrypt-devel
[root@linux tools]# yum -y install mhash
[root@linux tools]# yum -y install mcrypt
2、安装PHP
1)下载
https://www.php.net/distributions/php-5.3.27.tar.gz
2)解压配置
[root@linux tools]# tar zxf php-5.3.27.tar.gz
[root@linux tools]# cd php-5.3.27
[root@linux php-5.3.27]# ./configure \
--prefix=/application/php5.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-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-fpm \
--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 \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp
3)编译
[root@linux php-5.3.27]# ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
[root@linux php-5.3.27]# touch ext/phar/phar.phar
[root@linux php-5.3.27]# make
4)安装
[root@linux php-5.3.27]# make install
5)配置php.ini文件
[root@linux php-5.3.27]# ln -s /application/php5.3.27 /application/php
[root@linux php-5.3.27]# cp php.ini-production /application/php/lib/php.ini
6)配置FastCGI的配置文件php-fpm.conf
[root@linux php-5.3.27]# cd /application/php/etc/
[root@linux etc]# cp php-fpm.conf.default php-fpm.conf
7)启动php服务
[root@linux etc]# /application/php/sbin/php-fpm
8)检查php服务启动情况
[root@linux etc]# ps -ef|grep php-fpm
9)访问
nginx.conf文件location节点配置如下:
location / {
root html;
index index.html index.htm;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
Web根目录下,新建test.php文件,用如下内容填充:
<?php
phpinfo();
?>
访问:http://192.168.220.129/test.php,出现php探针页面,如下图:
php安装完成!