自动安装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服 ...
随机推荐
- Linux CPU负载状态:%us/%sy/%ni/%id/%wa/%hi/%si/%st含义
原文 Linux CPU负载状态:%us/%sy/%ni/%id/%wa/%hi/%si/%st含义 缙哥哥发现用了雅黑的探针,在 Linux 的 CPU 状态信息中发现,有“%us.%sy.%ni. ...
- Django ORM 之 单表、多表查询
返回ORM目录 Django ORM Django ORM 之一 内容目录: 一.单表查询 二.多表查询 0.准备工作 一些说明: - 表myapp_person的名称是自动生成的,如果你要自定义表名 ...
- HDFS HA
- hdu6393 Traffic Network in Numazu 树链剖分
题目传送门 题意:给出n个点n条边的无向带权图,再给出两种操作,操作1是将第x条边的边权修改为y,操作2是询问点x到点y的最短路径. 思路:如果是n个点n-1条边,题目就变成了树,修改边权和询问最短路 ...
- VGDB提示
由于之前地址的版本在未安装.Net 4.0的电脑上安装会出现插件使用装载失败的问题,已更新,新地址为:http://pan.baidu.com/s/1xdnuD,此版本需要.Net 2.0.
- override和overload区别
方法重载(overload)实现的是编译时的多态性(也称为前绑定) 方法重写(override)实现的是运行时的多态性(也称为后绑定)
- Spring Boot + Mybatis + H2 database数据库
H2 Database H2 由纯 Java 编写的开源关系数据库,可以直接嵌入到应用程序中,不受平台约束,便于测试. h2数据库特点 (1)性能.小巧 (2)同时支持网络版和嵌入式版本,另外还提供了 ...
- ios 中倒计时计算,时间戳为NaN
// 倒计时 daojishi(params) { let _this = this; let datetemp = this.servertimes; let lasttime = Date.par ...
- java实现单链表增删改查
package 数据结构算法.链表; /* *定义节点 * 链表由节点构成 */ public class Node<E> { private E e; //数据data private ...
- 在Rancher2中部署Docker-Registry仓库服务
1.docker登陆认证 [root@master ~]# vim /etc/docker/daemon.json { "insecure-registries": [" ...