码迷,mamicode.com
首页 > Web开发 > 详细

php编译安装脚本

时间:2017-07-13 19:06:34      阅读:146      评论:0      收藏:0      [点我收藏+]

标签: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


php编译安装脚本

标签:php

原文地址:http://12262646.blog.51cto.com/12252646/1947246

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!