首页 > 代码库 > 编译安装PHP-5.4.29环境

编译安装PHP-5.4.29环境

一、部署编译PHP环境,提前需要安装依赖包模块:

   libmcrypt、libmcrypt-devel、mhash、mhash-devel、mcrypt

   通过rpm -qa | grep 如检查没有安装,则进行安装

   备注:以下的安装方式都已经写成了简易脚本,安装起来比较方便


二、编译PHP环境所需模块

#!/bin/bash
# ------------------install libmcrypt-2.5.8 :: begin ------------------
cd /usr/local
mkdir libmcrypt
cp /app/install-tar/libmcrypt-2.5.8.tar.gz /usr/local/libmcrypt/
cd libmcrypt
tar xf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make check
make install


#!/bin/bash
# ------------------install mcrypt-2.6.8 :: begin --------------------
cd /usr/local
mkdir mcrypt
cp /app/mcrypt-2.6.8.tar.gz /usr/local/mcrypt/
cd mcrypt
tar xf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/mhash/lib
export LDFLAGS="-L/usr/local/mhash/lib -I/usr/local/mhash/include/"
export CFLAGS="-I/usr/local/mhash/include/"
export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
./configure
make
make check
make install


#!/bin/bash
# ------------------install mhash-0.9.9.9 :: begin --------------------
cd /usr/local
mkdir mhash
cp /app/install-tar/mhash-0.9.9.9.tar.gz /usr/local/mhash/
cd mhash
tar xf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make
make check
make install


三、模块安装完毕后,要开始正式编译PHP环境

#!/bin/bash
# ------------------install php-5.4.29 :: begin --------------------
cp /app/install-tar/php-5.4.29.tar.gz /app/
cd /app
tar zxvf php-5.4.29.tar.gz
cd php-5.4.29
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-config-file-scan-dir=/usr/local/php5/etc/php.d --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --disable-fileinfo        #不限制内存
make ZEND_EXTRA_LIBS=‘-liconv‘ 
make test
n
make install
#启动服务
cd /usr/local/php5/etc
mv php-fpm.conf.default php-fpm.conf
/usr/local/php5/sbin/php-fpm


服务命令参数:

启动: /usr/local/php5/sbin/php-fpm  
停止: pkill php-fpm


本文出自 “xiaobao” 博客,谢绝转载!

编译安装PHP-5.4.29环境