提前安装准备
yum groupinstall "development tools"
安装 libevent
安装libmcrypt
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
继续安装一些依赖软件
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl curl-devel openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel
Config 配置
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-fpm --with-curl --with-openssl --enable-mbregex --with-mysql --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --with-pdo-sqlite --enable-mysqlnd --with-gd --enable-gd-native-ttf --enable-exif --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-freetype-dir=/usr/local/freetype --enable-gd-jis-conv --with-gettext --with-zlib --enable-zip --with-bz2 --disable-fileinfo --enable-xmlreader --enable-xmlwriter --with-xmlrpc --enable-mbstring --enable-inline-optimization --enable-sockets --with-mcrypt --with-mhash --enable-pcntl
make && make install
复制配置文件
cp php.ini-development /usr/local/php/lib/php.ini
修改时区
date.timezone =Asia/Shanghai
另行编译扩展
cd ext/sockets
/usr/local/php/bin/phpize
./configure --prefix=/usr/local/php/lib --with-php-config=/usr/local/php/bin/php-config --enable-sockets
make && make install
将PHP加入系统环境变量
vim /etc/profile
在文件结束位置添加
export PATH=$PATH:/usr/local/php/bin/:/usr/local/php/sbin/
保存文件
最后执行命令 : source /etc/profile 重新加载环境