一键安装php5.6.40脚本(LAMP环境)
#!/bin/bash #安装依赖软件
yum -y install libxml2-devel curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel net-snmp net-snmp-devel #安装libiconv-1.14(下面使用sed增加2行,不增加会报错,详细查看www.cnblogs.com/blog-tim/p/10537708.html)
cd /usr/local/src/
wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -xf libiconv-1.14.tar.gz
sed -i '697a #if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)' /usr/local/src/libiconv-1.14/srclib/stdio.in.h
sed -i '699a #endif' /usr/local/src/libiconv-1.14/srclib/stdio.in.h
cd libiconv-1.14
./configure --prefix=/usr/local/php/libiconv && make && make install #安装libmcrypt-2.5.8
cd /usr/local/src/
wget -c http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar -xf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure && make && make install
/sbin/ldconfig && cd libltdl/
./configure --enable-ltdl-install && make && make install #安装mhash-0.9.9.9
cd /usr/local/src/
wget -c http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
tar -xf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure && make && make install #安装mcrypt-2.6.8
cd /usr/local/src/
wget -c http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
tar -xf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
/sbin/ldconfig && export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
./configure && make && make install #编译安装php-5.6.40
cd /usr/local/src/
wget -c http://jp2.php.net/distributions/php-5.6.40.tar.gz
tar -xf php-5.6.40.tar.gz
cd php-5.6.40
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-iconv=/usr/local/php/libiconv --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-jpeg-dir --with-png-dir --with-pear --with-freetype-dir --with-zlib --with-libxml-dir --with-iconv-dir --with-xmlrpc --with-mhash --with-mcrypt --with-curl --with-openssl --with-snmp --with-gettext --enable-pdo --enable-mbstring --enable-ctype --enable-simplexml --enable-ftp --enable-sockets --enable-gd-native-ttf --enable-sysvsem --enable-exif --enable-sysvshm --enable-xml --enable-dom --enable-simplexml --enable-shmop --enable-zip --enable-mbregex --enable-bcmath --enable-inline-optimization --enable-soap
make && make install #配置php和环境变量,关闭httpd服务
cp /usr/local/src/php-5.6.40/php.ini-production /usr/local/php/etc/php.ini
echo "export PATH=/usr/local/php/bin:$PATH" >>/etc/profile
source /etc/profile
killall -9 httpd #配置php首页,然后重新启动httpd服务
rm -f /var/www/html/index.html
cat > /var/www/html/index.php << EOF
<?php
phpinfo()
?>
EOF
/usr/local/apache/bin/apachectl start
安装完成后需检查apache主配置文件httpd.conf 中是否有增加 libphp5.so 模块内容
LoadModule php5_module modules/libphp5.so #<===编译安装PHP完成后会自动在apache主配置文件httpd.conf中产生此行
测试php5.6.40链接MySQL5.6.43是否成功,新建test.php文件到站点目录下,添加以下内容测试
[root@lamp html]# cat test.php
<?php
$servername = "10.0.0.3:3306";
$username = "oldboy";
$password = "123456";
$dbname = "mysql";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . mysqli_connect_error());
}else{
echo "this is connected";
}
?>
打开浏览器测试链接成功

注意:此脚本适用于LAMP环境,php在apache中以模块形式插入调用,而LNMP中php是进程方式运行!
一键安装php5.6.40脚本(LAMP环境)的更多相关文章
- centos7.5下yum安装php-5.6.40(LNMP环境)
cd /etc/yum.repos.d/ yum -y install epel-release #<===安装centos7下php5.6的epel和remi源 rpm -ivh http:/ ...
- Vultr VPS建站攻略 – 一键安装LNMP无面板高性能WEB环境
在"Vultr VPS建站攻略 - 一键安装宝塔面板架设LNMP/LAMP Web环境"文章中,VULTR中文网分享到我们常用的可视化面板宝塔面板安装在VULTR VPS主机中建站 ...
- 一键安装apache-2.4.38脚本
[root@lamp scripts]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@lamp scripts ...
- Vultr VPS建站攻略 – 一键安装宝塔面板架设LNMP/LAMP Web环境
我们选择VULTR VPS建站的还是比较多的,其主要原因在于商家的稳定,毕竟我们用来建站选择服务器价格考虑的不是主要的(当然VULTR价格也是比较便宜),最为主要的是因为VULTR商家比较稳定,而且多 ...
- CentOS6.x生产环境下一键安装mono+jexus的脚本,自启动,带服务,版本号自控
转自: http://linuxdot.net/bbsfile-3784 1.支持哪些个平台?答:暂时仅支持CentOS6.x平台,7.x未测试,欢迎测试并到群里反馈给我(昵称:无聊人士) 2.一键安 ...
- linux下一键安装 powershell,的bash脚本
说明 目前,linux下的powershell约等于pash.希望大家专注mono,关注pash. 一键安装脚本包括for centos6,centos7,ubuntu 14.04 ubuntu 1 ...
- 一键安装MySQL5.6.43脚本
[root@lamp ~]# cat /server/scripts/mysql-5.6.43_install.sh #!/bin/bash #卸载系统自带的Mysql /bin/rpm -e $(/ ...
- Oracle安装部署之一键安装oracle数据库及其脚本
准备工作:通过ftp工具上传oracle安装软件到linux系统/mnt目录下,并通过unzip命令解压软件.--------------------------------------------- ...
- 编译安装php5.5.7 脚本
#!/bin/bash .tar.gz ];then wget http://oss.aliyuncs.com/aliyunecs/onekey/php/php-5.5.7.tar.gz fi . ...
随机推荐
- JSON的学习与使用
.katex { display: block; text-align: center; white-space: nowrap; } .katex-display > .katex > ...
- 读取配置文件,appsettings.json和注入ICO
https://www.cnblogs.com/knowledgesea/p/7079880.html 引入Nuget的两个类库 Microsoft.Extensions.Configuration ...
- Java 1.7.0_06中String类内部实现的一些变化【转】
原文链接: java-performance 翻译: ImportNew.com- 夏千林译文链接: http://www.importnew.com/7656.html ChangeLog: 201 ...
- eclipse git 解决冲突 解决 mergetool 不能使用问题
eclipse git 解决冲突 解决 mergetool 不能使用问题 本地代码 远程代码 第一步 --> 同步远程资源库,检查是否存在冲突 这里有冲突出现 第二步 --> 如果存在冲突 ...
- iOS的项目目录结构
一.一般面试官都会问这样的一个问题,你怎样划分你项目的目录结构,就能测试出这个人是否有经验? 目前,比较常规的两种结构: 1.主目录按照业务分类,内目录按照模块分类(主目录按照MVC架构分类,内部根据 ...
- java 语句流程
一.if条件判断 太简单,不加说明 二.switch条件选择语句 注意: 1.switch(表达式),表达式的数据类型 byte/short/char/int/String/enum 2.别忘记写br ...
- Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name
目前有发现的两种情况 第一种:是在继承jpa的时候检查实体类@id和@Entity引进的包是否是 import javax.persistence.Id imprt javax.persistence ...
- 软件工程概论 网站开发要掌握的技术 &登录界面
1.网站系统开发需要掌握的技术 一.界面和用户体验(Interface and User Experience) 1.1 知道如何在基本不影响用户使用的情况下升级网站.通常来说,你必须有版本控制系统( ...
- 使用shiro 框架 报错No WebApplicationContext found: no ContextLoaderListener or DispatcherServlet registered?
1.问题描述:ssm 框架中使用shiro 中出现问题 原来web.xml 文件如下: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, ...
- Spring注解开发系列专栏
这个系列主要是讲Spring注解的使用,可以为后面SpringBoot的学习带来一定的帮助.我觉得从Spring直接过度到SpringBoot还是有点快,还是得需要一个演变的过程.从Spring开发, ...