centos6.3 mini php-5.5.3 php-5.4.19 nginx 1.4.2

2013-09-03 11:59:00 0  category: linux

php nginx 在centos 6.3 mini 下安装:


1, 安装相关库


[root@qcent6 ~]# yum -y install gcc autoconf gcc-c++ make libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel ldap-devel ncurses-devel openldap-devel zlib-devel bzip2-devel libbz2-devel



2, 获取 php-5.5.3 , php-5.4.19 , nginx 1.4.2


[root@qcent6 ~]#  wget http://www.php.net/get/php-5.5.3.tar.bz2/from/hk2.php.net/mirror

[root@qcent6 ~]# wget http://www.php.net/get/php-5.4.19.tar.bz2/from/tw2.php.net/mirror

[root@qcent6 ~]# wget http://nginx.org/download/nginx-1.4.2.tar.gz


3, 安装 nginx 1.4.2


[root@qcent6 ~]#/root/ # tar -xvf nginx-1.4.2.tar.gz

[root@qcent6 ~]#/root/ # cd nginx-1.4.2

[root@qcent6 ~]#/root/nginx-1.4.2 # ./configure --prefix=/usr/local/nginx142 --with-http_ssl_module

[root@qcent6 ~]#/root/nginx-1.4.2 # make && make install

[root@qcent6 ~]#/root # echo "/usr/local/nginx142/sbin/nginx" >> /etc/rc.local //开机自动启动


4. 安装 php-5.5.3


[root@qcent6 ~]#/root # tar xvf php-5.5.3.tar.bz2

[root@qcent6 ~]#/root # cd php-5.5.3

[root@qcent6 ~]#/root/php-5.5.3 # ./configure --prefix=/usr/local/php553 --with-config-file-path=/usr/local/php553/etc --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-zlib --with-bz2 --with-curl --with-libxml-dir --with-mhash --enable-mbstring --with-mcrypt --enable-xml --enable-sockets --enable-zip --enable-bcmath --enable-opcache

[root@qcent6 ~]#/root/php-5.5.3 # make && make install

[root@qcent6 ~]#/root/php-5.5.3 # cp php.ini-development /usr/local/php553/etc/php.ini

[root@qcent6 ~]#/root/php-5.5.3 # cp sapi/fpm/init.d.php-fpm /usr/local/php553/etc/php-fpm.rc

[root@qcent6 ~]#/root/php-5.5.3 # cd /usr/local/php553/etc/

[root@qcent6 ~]#/usr/local/php553/etc # mv php-fpm.conf.default php-fpm.conf

[root@qcent6 ~]#/usr/local/php553/etc # vim php-fpm.conf
// pid = run/php-fpm.pid 修改第25行
// listen = 127.0.0.1:9005 修改第159行
// request_terminate_timeout = 120 // 修改第444 行

[root@qcent6 ~]#/usr/local/php553/etc # chmod +x php-fpm.rc

[root@qcent6 ~]#/usr/local/php553/etc # echo "/usr/local/php553/etc/php-fpm.rc start" >> /etc/rc.local




4. 安装 php-5.4.19




[root@qcent6 ~]#/root/ # tar -xvf php-5.4.19.tar.bz2

[root@qcent6 ~]#/root/ # cd php-5.4.19

[root@qcent6 ~]#/root/php-5.4.19 # ./configure --prefix=/usr/local/php5419 --with-config-file-path=/usr/local/php5419/etc --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-zlib --with-bz2 --with-curl --with-libxml-dir --with-mhash --enable-mbstring --with-mcrypt --enable-xml --enable-sockets --enable-zip --enable-bcmath

[root@qcent6 ~]#/root/php-5.4.19 # make && make install

[root@qcent6 ~]#/root/php-5.4.19 # cp php.ini-development /usr/local/php5419/etc/php.ini

[root@qcent6 ~]#/root/php-5.4.19 # cp sapi/fpm/init.d.php-fpm /usr/local/php5419/etc/php-fpm.rc

[root@qcent6 ~]#/root/php-5.4.19 # cd /usr/local/php5419/etc/

[root@qcent6 ~]#/usr/local/php5419/etc # mv php-fpm.conf.default php-fpm.conf

[root@qcent6 ~]#/usr/local/php5419/etc # vim php-fpm.conf
// pid = run/php-fpm.pid //25行去掉注释
// listen = 127.0.0.1:9004 // 159 行修改
// request_terminate_timeout = 120 // 444 行 修改

[root@qcent6 ~]#/usr/local/php5419/etc # chmod a+x php-fpm.rc

[root@qcent6 ~]#/usr/local/php5419/etc # echo "/usr/local/php5419/etc/php-fpm.rc start" >> /etc/rc.local //开机自动启动