php环境一键升级脚本
因为要解析PHP页面需要配置相应的PHP环境,而系统本身的php版本又大多不合适。网上那种一键lamp和lnmp的脚本很多,但是这样一来自己能够定制的空间则少了。所以我自己编写了个门用于安装php环境的脚本!
脚本内容:
#!/bin/bash
if [ $(id -u) != 0 ] ;then
echo "ERROR: you must be root to run this script"
exit 1
fi
read -p "Are you ready to installing the new PHP environment ?you can input 'y|Y' to continue or 'n|N' to exit." choice
case $choice in
[Yy])
echo "The setup program is preparing,please wait a minute........"
ping -c 4 museum.php.net &> /dev/null
if [ $? != 0 ];then
echo "Can't connected to the internet or can't resolve domain name,please check your network"
exit 2
fi
yum install epel-release -y
which wget &> /dev/null
if [ $? != 0 ];then
echo "wget not exist,please install wget before install"
exit 3
fi
while true;do
read -p "Please input which version of PHP do you want to install like x.x.x:" version
if [[ $version =~ ^[0-9]\.[0-9]\.[0-9]$ ]];then
wget museum.php.net/php${version:0:1}/php-${version}.tar.gz
if [ $? != 0 ] ;then
echo "You choose a wrong version of PHP,please input another version for install^-^!"
exit 8
fi
break
else
echo "Please input correct version of number"
fi
done
echo "Start to installing dependent environment!"
sleep 3
yum install openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel gcc gcc-c++ libxml2 libxml2-devel bzip2 bzip2-devel libmcrypt libmcrypt-devel openssl openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel readline readline-devel libxslt-devel perl perl-devel psmisc.x86_64 recode recode-devel libtidy libtidy-devel libicu-devel -y
tar -xf php-${version}.tar.gz
cd ./php-${version}
./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib -with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-intl
make && make install
if [ $? == 0 ];then
cp php.ini-development /usr/local/php/lib/php.ini
sed -i 's/post_max_size.*/post_max_size = 16M/' /usr/local/php/lib/php.ini
sed -i 's/max_execution_time.*/max_execution_time = 300/' /usr/local/php/lib/php.ini
sed -i 's/max_input_time.*/max_input_time = 300/' /usr/local/php/lib/php.ini
sed -i 's/;mbstring.func_overload = 0/mbstring.func_overload = 0/' /usr/local/php/lib/php.ini
sed -i 's/;always_populate_raw_post_data = -1/always_populate_raw_post_data = -1/' /usr/local/php/lib/php.ini
sed -i 's/;date.timezone.*/date.timezone = Asia\/Shanghai/' /usr/local/php/lib/php.ini
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 sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
echo "export PATH=\$PATH:/usr/local/php/bin" >> /etc/profile
echo -e "php-${version} has been successfully installed!\nif you want import the php to environmental variables......\nplease executed the command 【source /etc/profile】"
cd ..
rm -rf php-${version}*
else
cd ..
rm -rf php-${version}*
echo -e "\033[5;31mCompilation install failed!\033[0m"
fi
;;
[Nn])
echo "Install aborting!"
exit 4
;;
esac
php环境一键升级脚本的更多相关文章
- CentOS 升级 Python3 (附带: 一键升级脚本)
升级环境 应用名称 版本 Python 3.5.2 Syatem CentOS 6.7 升级方法 [1]下载 Python 3: wget http://mirrors.s ...
- Centos 环境一键部署脚本(shell脚本)
谨以此文纪念吊炸天的Centos环境一键部署方案的新鲜出炉 辛苦大半年,产品准备上线了,BOSS亲自体验安装部署,看着超过200+页的安装文档直接崩溃了(需要部署23个基础服务),经历了超过3个小时的 ...
- openssh一键升级脚本(测试成功)
1 ssh版本检查 本文档针对于ssh版本低于7.0的系统,升级为openssh7.5 p1. ssh –V [root@kuajing-db3 ~]# ssh -V OpenSSH_5.3p1, O ...
- openssh一键升级脚本(只升级openssh,其它已有环境不变,解决root登录问题)
#!/bin/bash ################################################################# ###### update openssl ...
- LNMP一键安装包 PHP自动升级脚本
LNMP一键安装包 PHP自动升级脚本 2011年03月15日 上午 | 作者:VPS侦探 前一段时间完成了lnmp一键安装包的PHP自动升级脚本,今天发布出来,如果想升级PHP版本的lnmp用户可以 ...
- jdk1.8一键安装脚本(linux环境)
1.下载jdk安装包和安装脚本 下载地址:https://pan.baidu.com/s/1bo6ADQ3 其中包括: jdk安装包:jdk-8u151-linux-x64.tar.gz jdk一键安 ...
- asp.net 版本一键升级,后台直接调用升级脚本
应客户需求,要求实现一个版本一键升级的功能,咨询过同事之后弄了个demo出来,后台代码如下: //DBConnModelInfo:连接字符串的对象 (包含数据库实例名,数据库名,登陆名,登陆密码) p ...
- LNMP、LAMP、LANMP一键安装脚本(定期更新)[转]
这个脚本是使用shell编写,为了快速在生产环境上部署LNMP/LAMP/LANMP(Linux.Nginx/Tengine.MySQL/MariaDB/Percona.PHP),适用于CentOS/ ...
- L2TP/IPSec一键安装脚本
本脚本适用环境:系统支持:CentOS6+,Debian7+,Ubuntu12+内存要求:≥128M更新日期:2017 年 05 月 28 日 关于本脚本:名词解释如下L2TP(Layer 2 Tun ...
随机推荐
- 命名元组nametuple
# coding:utf-8 from collections import namedtuple Student = namedtuple('Student', ['no', 'name', 'ag ...
- 6_14 Abbott的复仇(UVa816)<图的最短路BFS>
1999次世界总决赛的比赛包括一个骰子迷宫问题.在这个问题被写的时候,法官们无法发现骰子迷宫概念的原始来源.不久之后的比赛,但是,罗伯特先生雅培,无数的迷宫和对作者的创造者主题,联系大赛评委,自称是骰 ...
- 使用git上传项目解决码云文件次数上传限制(原文)
起因:个人免费版的码云上传文件时限制: 1个小时内只能上传20个文件 解决方法:在码云创建空的项目仓库,使用git客户端下载码云的项目,把需要上传的文件复制到该项目中去,用git提交! 1.配置git ...
- 在spring Boot中使用swagger-bootstrap-ui(原文)
1.swagger简介 Swagger是一个API接口管理工具,支持在线测试接口数据,根据配置自动生成API文档,结合spring mvc而提供界面化方法文档的一个开源框架. 1.1Swagger主要 ...
- python 鸢尾花数据集报表展示
import seaborn as snsimport pandas as pdimport matplotlib.pyplot as pltsns.set_style('white',{'font. ...
- 吴裕雄 python 机器学习——支持向量机线性分类LinearSVC模型
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, linear_model,svm fr ...
- 【原】接口mock作用
1.前后端 接口定义完成 并发开工 2.测试拿到mock接口 编写用例 3.mock接口 模拟异常服务器返回值 500 404 4.mock接口 模拟数据 不修改线上数据库
- c# /MVC设置类的自定义特性
public class MarkStaticAttribute:Attribute { public MarkStaticAttribute(bool mark=true) { _IsMark = ...
- Python - 定时动态获取IP代理池,存放在文件中
定时功能通过module time + 死循环实现,因为time.sleep()会自动阻塞 get_ip_pool.py """ @__note__: while Tru ...
- mac停靠栏动画
MAC停靠栏 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <ti ...