详解PHP

检查安装基本组件库

yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel

yum install -y freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel icu libicu libicu-devel

cd /usr/local/src

wget http://luopengtest.gotoip2.com/shell/lnmp/libiconv-1.15.tar.gz

tar xzf libiconv-1.15.tar.gz

cd libiconv-1.15

mkdir -p /usr/local/libiconv

./configure –prefix=/usr/local/libiconv/

make

make install

配置epel源

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

yum install -y libmcrypt-devel mhash mcrypt

wget http://luopengtest.gotoip2.com/shell/lnmp/php-5.6.32.tar.gz

tar xzf php-5.6.32.tar.gz

cd php-5.6.32

mkdir -p /usr/local/php

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc \

--with-config-file-scan-dir=/usr/local/php/etc/php.d \

--with-fpm-user=www –with-fpm-group=www –enable-fpm –disable-opcache –disable-fileinfo \

--with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd \

--with-iconv-dir=/usr/local/libiconv –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib \

--with-libxml-dir –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-exif \

--enable-sysvsem –enable-inline-optimization –with-curl=/usr/local –enable-mbregex \

--enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl \

--with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-ftp –enable-intl –with-xsl \

--with-gettext –enable-zip –enable-soap –disable-debug $php_modules_options

make

make install

[ -z “`grep ^’export PATH=’ /etc/profile`“ ] && echo “export PATH=/usr/local/php/bin:\$PATH” >> /etc/profile

[ -n “`grep ^’export PATH=’ /etc/profile`“ -a -z “`grep $php_install_dir /etc/profile`“ ] && sed -i “s@^export PATH=\(.*\)@export PATH=/usr/local/php/bin:\1@” /etc/profile

. /etc/profile

/bin/cp php.ini-production $php_install_dir/etc/php.ini

/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

chkconfig –add php-fpm && chkconfig php-fpm on

http://luopengtest.gotoip2.com/shell/lnmp/php.sh php自动安装shell脚本