#!/bin/bash
#by dxd in -
#only suit for centos/aliyun os, and based on aliyun install script CURR_PATH=$(pwd) DOWNLOAD_LIBMCRYPT_URL=http://download.verymall.cn/libmcrypt-2.5.8.tar.gz
DOWNLOAD_PHP7_URL=http://download.verymall.cn/php7.bz2
DOWNLOAD_PHP_INI_URL=http://download.verymall.cn/php7.ini
PHP_INSTALL_PATH=/alidata/server/php7
PHP_FPM_PORT= function check_user()
{
if [ "$(whoami)" != "root" ]
then
echo "please run as root"
exit
fi
} function update_linux()
{
yum update && yum upgrade
yum groupinstall "Development Tools"
yum install gcc gcc-c++ pcre* openssl* gd-devel* zlib-devel pcre-devel libxml2-devel curl-devel
} function check_curr_path_auth()
{
if [ ! -w $CURR_PATH ]
then
echo "current path has no write auth"
exit
fi
} function is_curr_path_legal()
{
if [ "$(ls | grep install.sh)" == "" ]
then
echo "path is illegal"
exit
fi
} function check_gcc()
{
which gcc > /dev/null >&
if [ "$?" != "" ]
then
echo "please install gcc first"
exit
fi
} function check_fpm_port()
{
if [ -n "$(lsof -i:$PHP_FPM_PORT)" ]
then
echo "PORT $PHP_FPM_PORT is occupied"
exit
fi
} function check_alidata_path()
{
if [ ! -d /alidata ]
then
mkdir /alidata
fi if [ ! -d /alidata/server ]
then
echo "alidata server has not been installed"
exit
fi mkdir $PHP_INSTALL_PATH
} function install_dos2unix()
{
which dos2unix > /dev/null >&
if [ "$?" != "" ]
then
yum install dos2unix
fi
} function download_and_install_libmcrypt()
{
if [ -a ./libmcrypt-2.5..tar.gz ] && [ -n "$(md5sum ./libmcrypt-2.5.8.tar.gz | grep 0821830d930a86a5c69110837c55b7da)" ]
then
echo "./libmcrypt-2.5.8.tar.gz exist"
else
rm -f ./libmcrypt-2.5..tar.gz
wget $DOWNLOAD_LIBMCRYPT_URL
fi tar -zxvf ./libmcrypt-2.5..tar.gz
cd ./libmcrypt-2.5.
./configure
make
make install cd $CURR_PATH
} function update_ld()
{
if [ -z "$(cat /etc/ld.so.conf | grep /usr/local/lib)" ]
then
echo "/usr/local/lib" >> /etc/ld.so.conf
fi if [ -z "$(cat /etc/ld.so.conf | grep /usr/lib64)" ]
then
echo "/usr/lib64" >> /etc/ld.so.conf
fi ldconfig
} function download_php7()
{
cd $CURR_PATH if [ -a ./php7.bz2 ] && [ -n "$(md5sum ./php7.bz2 | grep fb88987cd0c7fefa527f2170a2617f78)" ]
then
echo "./php7.bz2 exist"
else
rm -f ./php7.bz2
wget $DOWNLOAD_PHP7_URL
fi #uncompress bz2 file
tar -xvf ./php7.bz2 > /dev/null
} function install_php7()
{
cd $CURR_PATH
cd ./php-7.1. mkdir /usr/lib64/
ln -s /usr/local/lib/libiconv.so. /usr/lib64/ ./configure \
--prefix=$PHP_INSTALL_PATH \
--exec-prefix=$PHP_INSTALL_PATH \
--bindir=$PHP_INSTALL_PATH/bin \
--sbindir=$PHP_INSTALL_PATH/sbin \
--includedir=$PHP_INSTALL_PATH/include \
--libdir=$PHP_INSTALL_PATH/lib/php \
--mandir=$PHP_INSTALL_PATH/php/man \
--with-config-file-path=$PHP_INSTALL_PATH/etc \
--with-mcrypt=/usr/include \
--with-mhash \
--with-openssl \
--with-mysqli=shared,mysqlnd \
--with-pdo-mysql=shared,mysqlnd \
--with-gd \
--with-iconv \
--with-zlib \
--enable-zip \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-xml \
--enable-bcmath \
-enable-shmop \
--enable-sysvsem \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--enable-opcache \
--enable-fpm \
--without-gdbm \
--enable-fileinfo
# --disable-fileinfo make ZEND_EXTRA_LIBS='-liconv'
make install
} function config_php7()
{
if [ ! -a $PHP_INSTALL_PATH/etc/php-fpm.conf ]
then
cp $PHP_INSTALL_PATH/etc/php-fpm.conf.default $PHP_INSTALL_PATH/etc/php-fpm.conf
fi if [ ! -a $PHP_INSTALL_PATH/etc/php-fpm.d/www.conf ]
then
cp $PHP_INSTALL_PATH/etc/php-fpm.d/www.conf.default $PHP_INSTALL_PATH/etc/php-fpm.d/www.conf
fi if [ -z "$(cat $PHP_INSTALL_PATH/etc/php-fpm.conf | grep 127)" ]
then
echo "listen = 127.0.0.1:$PHP_FPM_PORT" >> $PHP_INSTALL_PATH/etc/php-fpm.conf
echo "listen.backlog = -1" >> $PHP_INSTALL_PATH/etc/php-fpm.conf
echo "listen.owner = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf
echo "listen.group = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf
echo "listen.mode = 0666" >> $PHP_INSTALL_PATH/etc/php-fpm.conf
echo "user = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf
echo "group = www" >> $PHP_INSTALL_PATH/etc/php-fpm.conf
fi if [ ! -a $PHP_INSTALL_PATH/etc/php.ini ]
then
wget $DOWNLOAD_PHP_INI_URL -O $PHP_INSTALL_PATH/etc/php.ini
fi
} function start_php_fpm()
{
$PHP_INSTALL_PATH/sbin/php-fpm
} check_user
update_linux
is_curr_path_legal
check_curr_path_auth
check_gcc
check_fpm_port
check_alidata_path
install_dos2unix
download_and_install_libmcrypt
update_ld
download_php7
install_php7
config_php7
start_php_fpm echo "php7 install successfully"
exit

博主附后:

启动php7 phpfpm
/alidata/server/php7/sbin/php-fpm

关闭php7 phpfpm
lsof -i :9001 | cut -d " " -f 2 | xargs kill -9

for i in $(lsof -i :9001 | cut -d " " -f 2)
do
kill $i
done

自动安装php7(配置未优化版本)的更多相关文章

  1. Nginx与Tomcat安装、配置与优化

    Nginx与Tomcat安装.配置与优化 Nginx与Tomcat安装.配置与优化 Nginx的安装与使用 Nginx是一款优秀的反向代理服务器 安装: rpm(或者是pkg安装),是预编译好的程序包 ...

  2. windows下安装和配置多个版本的JDK

    https://jingyan.baidu.com/article/47a29f2474ba55c015239957.html 如何在windows下安装和配置多个版本的jdk,本文将带你在windo ...

  3. Mysql的安装、配置、优化

    Mysql的安装.配置.优化 安装步骤 1.先单击中的安装文件,如果是win7系统,请选择以管理员的方式运行. 2.大概需要30秒的时间,开始进入安装界面.请先把标红的打勾,好进行下一步的动作. 3. ...

  4. 实战Nginx与PHP(FastCGI)的安装、配置与优化

    一.什么是 FastCGIFastCGI是一个可伸缩地.高速地在HTTP server和动态脚本语言间通信的接口.多数流行的HTTP server都支持FastCGI,包括Apache.Nginx和l ...

  5. 【转】实战Nginx与PHP(FastCGI)的安装、配置与优化

    原文连接:http://ixdba.blog.51cto.com/2895551/806622 原文作者:南非蚂蚁 转载注明以上信息 一.什么是 FastCGIFastCGI是一个可伸缩地.高速地在H ...

  6. 【收藏】实战Nginx与PHP(FastCGI)的安装、配置与优化

    拜读南非蚂蚁大牛的文章真是有所收获 http://ixdba.blog.51cto.com/2895551/806622 一.什么是 FastCGI FastCGI是一个可伸缩地.高速地在HTTP s ...

  7. php-fpm安装、配置与优化

    转载自:https://www.zybuluo.com/phper/note/89081 1.php中fastcgi和php-fpm是什么东西 最近在研究和学习PHP的性能方面的知识,看到了factc ...

  8. 企业级自动化部署方案——ansible实现tomcat自动安装和配置

    共耗时10多个小时 思路一 总体设计 ansible-playbook目录结构 [root@ansible ~]# tree /etc/ansible/roles/tomcat /etc/ansibl ...

  9. Tomcat安装、配置、优化及负载均衡详解

    一.常见JavaWeb服务器      1.WebLogic:是BEA公司的产品.WebSphereAS:是IBM公司的产品.JBossAS:红帽公司的产品,可以自行了解      2.Tomcat服 ...

随机推荐

  1. NEERC 1999 Advertisement /// oj22646

    题目大意: 输入k,n :k为每位慢跑者最少应看到的广告牌数 接下来n行 描述第 i 位慢跑者的途径路段 输出需要设立的广告牌数 接下来每行为设立地点 Sample Input 5 101 1020 ...

  2. 【POJ】2236 Wireless Network

    题目链接:http://poj.org/problem?id=2236 题意:给你n台计算机的坐标.d是可通信的最大距离.有两个操作. 1.O p 表示修复计算机p. 2.S p q表示询问pq是否能 ...

  3. 织梦自增函数[field:global name=autoindex/]常见用法

    看来不少朋友需要不了解这个自增函数的用法,在这里我列举一些常见的写法以及作用.   [field:global name=autoindex/] !--普通打印递增的数字-- [field:globa ...

  4. python3 日志重复打印logger

    在python2中正常的日志,单只直接使用python3,发现日志重复了,其实是handlers多添加的原因, python2代码 ---------------------------------- ...

  5. 【第三周读书笔记】浅谈node.js中的异步回调和用js-xlsx操作Excel表格

    在初步学习了node.js之后,我发现他的时序问题我一直都很模糊不清,所以我专门学习了一下这一块. 首先我们来形象地理解一下进程和线程: 进程:CPU执行任务的模块.线程:模块中的最小单元. 例如:c ...

  6. Redis本地集群搭建(5版本以上)

    Redis本地集群搭建(5版本以上) 2019年11月3日10:05:48 步骤 1.下载安装Redis的安装包 2.复制5份,一共6份Redis的解压安装版,修改每个Redis节点的端口并开启节点 ...

  7. Altera FPGA– Bit Slip

    通过在接收端加延时,在延时间隙插入'0'或'1',以使最终接收和期望数据一致. BitSlip操作要注意几点: 1,BitSlip操作在rx_bitslip的上升沿即开始: 2,BitSlip操作开始 ...

  8. java变量和数据类型

    变量 数据类型  变量名  =  数据值: 注意事项: 变量定义后可以不赋值,使用时再赋值.不赋值不能使用 变量使用时有作用域的限制. 变量不可以重复定义 数据类型转换 自动类型转换  范围大的数据类 ...

  9. 校园商铺-2项目设计和框架搭建-6逐层完成SSM的各项配置

    1. 创建/src/main/resources/jdbc.properties文件 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://l ...

  10. System.Web.Mvc.RoutePrefixAttribute.cs

    ylbtech-System.Web.Mvc.RoutePrefixAttribute.cs 1.程序集 System.Web.Mvc, Version=5.2.3.0, Culture=neutra ...