自动安装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服 ...
随机推荐
- 2018湘潭大学程序设计竞赛【D】
题目链接:https://www.nowcoder.com/acm/contest/105/D 题意:就是数的fib表示方法.按权展开,又按二进制算出结果输出. 题解:贪心和数论吧.找到跟数最接近的f ...
- IK的整个分词处理过程
首先,介绍一下IK的整个分词处理过程: 1. Lucene的分词基类是Analyzer,所以IK提供了Analyzer的一个实现类IKAnalyzer.首先,我们要实例化一个IKAnalyzer,它有 ...
- Unity中DoTween的使用
在Unity手游开发中,经常用到插值运算,我们可以使用Mathf.Lerp自行去实现效果,但是使用插件提高了我们的开发效率,这里归结一下DoTween的基本使用方式以及效果说明: 直接代码: usin ...
- PKPM快捷键
e删除sc删除节点hq绘制直线墙lbz布置梁zz楼层组装bsc板生成bxg板修改门窗洞dbz(洞布置)全房间洞(fd)正交轴网zww拉伸s
- 502Bad Gateway
502 bad gateway,错误的网关的原因 连接超时,我们向服务器发送请求,由于服务器当前链接太多,导致服务器方面无法给予正常的响应,产生此报错,最好去服务器上找原因. 性能测试常见,可能是由于 ...
- Python: 生成器与迭代 generators and iteration
https://eastlakeside.gitbooks.io/interpy-zh/content/Generators/ 文章不是非常好 1,三个概念 可迭代对象 iterable, 迭代器 i ...
- [JZOJ3692] 【SRM 611】ElephantDrinking
题目 题目大意 我真的不知道怎么用简短的语言表述出来-- 直接看题目吧-- 正解 假设只有左边和上边延伸过来的,那似乎很好办:设\(f_{i,j}\)表示左上方到\((i,j)\)所形成的矩形中,如果 ...
- jupyter|魔法函数问题| UsageError: Line magic function `%` not found
问题: jupyter notebook 使用魔法函数% matplotlib inline,报错:UsageError: Line magic function `%` not found 解决: ...
- [转]MySQL InnoDB引擎索引长度受限怎么办
mysql> CREATE TABLE `tb` (-> `a` varchar(255) DEFAULT NULL,-> `b` varchar(255) DEFAULT NULL ...
- eclipse查看源码的配置
1.打开eclipse软件,点击window-preference 2.在弹出框中选择java-Installed JRES,选中的默认就行,然后点一下选中的,点击edit 3.弹出框中选择第二个,展 ...