php编译安装脚本
#!/bin/bash
#Date:2017-05-05 By Allen_Jol
#--------- YUm Install related components------
sleep 3
创新互联公司自2013年创立以来,先为平山等服务建站,平山等地企业,进行企业商务咨询服务。为平山企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
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编译安装脚本
当前地址:http://myzitong.com/article/jegsho.html