首先进入 /usr/local/src/ 目录下,然后运行下面命令下载php包
wget http://cn2.php.net/distributions/php-5.6.2.tar.gz
tar -zxvf php-5.6.2.tar.gz cd php-5.6.2
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-freetype-dir --with-png-dir --with-iconv-dir --with-zlib-dir --with-mcryp --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl
make && make install
修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码
PATH=$PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin export PATH
执行 命令source /etc/profile