php编译安装脚本-创新互联

#!/bin/bash
#Date:2017-05-05 By Allen_Jol
#--------- YUm Install related components------
sleep 3

创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站建设、成都做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的牧野网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

yum install -y gcc gcc-c++ autoconf automake libtool make cmake 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 ncurses-devel curl 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 libmcrypt libmcrypt-devel bison-devel openssl openssl-devel zlib zlib-devel pcre pcre-devel

mkdir /lnmpsoftware

#-----------Download PHP server-----------------

sleep 3
cd /lnmpsoftware

tar -zxvf libmcrypt-2.5.8.tar.gz
tar -zxvf mhash-0.9.9.9.tar.gz

cd /lnmpsoftware/libmcrypt-2.5.8
./configure
make && make install
sleep 3

#cd .. 我单独把php脚本拿出来,做php的时候测试这里需要切换到/usr/local/src下

cd /lnmpsoftware
cd mhash-0.9.9.9
./configure
make && make install

sleep 3

cd /lnmpsoftware

if [ ! -f php-7.0.6.tar.gz ]
then
  wget -O php-7.0.6.tar.gz http://cn2.php.net/get/php-7.0.6.tar.gz/from/this/mirror
fi
#--------------Install PHP server-----------------

tar -zxvf php-7.0.6.tar.gz
cd php-7.0.6
if [ ! -f /usr/local/php/etc/php.ini ]
then
./buildconf --force
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-config-file-scan-dir=/usr/local/php/etc/conf.d \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-soap \
--with-openssl \
--with-openssl-dir \
--with-mcrypt \
--with-pcre-regex \
--with-zlib \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-mbstring \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-pdo-mysql \
--with-zlib-dir \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd \
--with-mysqli \
--without-pear
sleep 3

make -j 4 && make install

fi

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

cp php.ini-production /usr/local/php/etc/php.ini
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
groupadd www
useradd -s /sbin/nologin -g www -M www

sed -ri -e 's#;date.timezone =#date.timezone = PRC#g' -e 's#;cgi.fix_pathinfo=1#cgi.fix_pathinfo=0#g' /usr/local/php/etc/php.ini

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章名称:php编译安装脚本-创新互联
转载来源:http://scyanting.com/article/cspogh.html