自动安装php7(配置未优化版本)
#!/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(配置未优化版本)的更多相关文章
- Nginx与Tomcat安装、配置与优化
Nginx与Tomcat安装.配置与优化 Nginx与Tomcat安装.配置与优化 Nginx的安装与使用 Nginx是一款优秀的反向代理服务器 安装: rpm(或者是pkg安装),是预编译好的程序包 ...
- windows下安装和配置多个版本的JDK
https://jingyan.baidu.com/article/47a29f2474ba55c015239957.html 如何在windows下安装和配置多个版本的jdk,本文将带你在windo ...
- Mysql的安装、配置、优化
Mysql的安装.配置.优化 安装步骤 1.先单击中的安装文件,如果是win7系统,请选择以管理员的方式运行. 2.大概需要30秒的时间,开始进入安装界面.请先把标红的打勾,好进行下一步的动作. 3. ...
- 实战Nginx与PHP(FastCGI)的安装、配置与优化
一.什么是 FastCGIFastCGI是一个可伸缩地.高速地在HTTP server和动态脚本语言间通信的接口.多数流行的HTTP server都支持FastCGI,包括Apache.Nginx和l ...
- 【转】实战Nginx与PHP(FastCGI)的安装、配置与优化
原文连接:http://ixdba.blog.51cto.com/2895551/806622 原文作者:南非蚂蚁 转载注明以上信息 一.什么是 FastCGIFastCGI是一个可伸缩地.高速地在H ...
- 【收藏】实战Nginx与PHP(FastCGI)的安装、配置与优化
拜读南非蚂蚁大牛的文章真是有所收获 http://ixdba.blog.51cto.com/2895551/806622 一.什么是 FastCGI FastCGI是一个可伸缩地.高速地在HTTP s ...
- php-fpm安装、配置与优化
转载自:https://www.zybuluo.com/phper/note/89081 1.php中fastcgi和php-fpm是什么东西 最近在研究和学习PHP的性能方面的知识,看到了factc ...
- 企业级自动化部署方案——ansible实现tomcat自动安装和配置
共耗时10多个小时 思路一 总体设计 ansible-playbook目录结构 [root@ansible ~]# tree /etc/ansible/roles/tomcat /etc/ansibl ...
- Tomcat安装、配置、优化及负载均衡详解
一.常见JavaWeb服务器 1.WebLogic:是BEA公司的产品.WebSphereAS:是IBM公司的产品.JBossAS:红帽公司的产品,可以自行了解 2.Tomcat服 ...
随机推荐
- python中面向对象
一.Python经典类与新类 经典类:如果没有直接或间接的子类化一个对象,也就是说如果没有指定一个父类,或者是如果子类化的基本类没有父类,那么就定义了经典类: class classics: 'def ...
- gmock 简单笔记
std::shared_ptr<MockThreadRCInvester> spMockaAcc; HelperThreadRCInvester helperAcc; // spMockA ...
- wpf datagrid 如何自定义行的控件实例,(textbox 并选中则全选)
主要是为了用户输入方便 按回车,选中下一列,text自动获取焦点,输入状态 获取控件实例 https://blog.csdn.net/m15188153014/article/details/486 ...
- [JZOJ6278] 2019.8.5【NOIP提高组A】跳房子
题目 题目大意 给你一个矩阵,从\((1,1)\)开始,每次往右上.右.右下三个格子中权值最大的那个跳. 第一行上面是第\(n\)行,第\(m\)列右边是第\(1\)列.反之同理. 有两个操作:跳\( ...
- 初识Qgis
折腾了一天,qgis终于能在跟了自己8年的本本上顺利打开了,官网先后下载了3.8和3.4版本的都出现了同样的问题,"could not load qgis_app.dll",goo ...
- EXCEL函数常用技巧浅析
EXCEL函数常用技巧浅析 EXCEL函数是一门趣味性非常大的游戏,此贴内容基本上为总结前人经验而来.废话不多说,我们现在走入正题. 一:判断数值奇偶性 1.1 ISODD(number) 判断一个 ...
- Spring IOC基础回顾 — 组件扫描和装配
目录 注解形式配置应用IOC 1. 组件自动扫描 2. 组件依赖:为bean添加注解,实现自动注入 3. Spring IOC应用小结 注解形式配置应用IOC 在类定义.方法定义.成员变量定义前使用, ...
- 宇宙最强 IDE:VS 2019 正式发布
作者:局长 来源:www.oschina.net/news/105629/ 如约而至,微软已于今天推出 Visual Studio 2019 正式版,一同发布的还有 Visual Studio 201 ...
- 金融IT的算法要求
岗位职责 1.负责宏观经济预测的算法研究 2.负责债券.股票.基金等品种的模型研究 3.负责持仓收益分析,及绩效归因等模型研究 任职要求 1.一般数学: 线性代数与矩阵运算 随机过程 微积分 概率论 ...
- Linux 实用指令(8)--网络配置
目录 网络配置 1 Linux网络配置原理图(含虚拟机) 2 查看网络IP和网关 2.1 查询虚拟网络编辑器 2.2 修改IP地址(修改虚拟网络的IP) 2.3 查看网关 2.4 查看windows环 ...