Centos7源码安装Apache和PHP
源码安装Apache
安装需要的依赖
yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel
#pcre是正则表达式库
#openssl是安全通信的库
安装apr和apr-until
#apr是Apache可移植运行时
#apr-until是Apache可移植运行时实用程序库
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar xf apr-1.7.0.tar.gz
tar xf apr-util-1.6.1.tar.gz
cd apr-1.7.0
./configure
make && make install
cd ..
cd apr-util-1.6.1
./configure --with-apr=/usr/local/apr/
make && make install
cd ..
安装Apache
服务和模块
wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.41.tar.gz
tar xf httpd-2.4.41.tar.gz
cd httpd-2.4.41
./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --enable-rewrite --with-mpm=worker --with-suexec-bin --with-apr=/usr/local/apr/
make && make install
vim /usr/local/apache2/conf/httpd.conf #Apache配置文件
/usr/local/apache2/bin/apachectl start #启动Apache服务
/usr/local/apache2/bin/apachectl stop #停止
选项 | 描述 |
---|---|
--prefix | 指定 Apache httpd 程序的安装主目录 |
--enable-so | 开启模块化功能,支持DSO(动态共享对象) |
--enbale-ssl | 支持 SSL 加密 |
--enable-rewrite | 支持地址重写 |
--with-mpm | 设置 Apache httpd 工作模式 |
--with-suexec-bin | 支持 SUID、SGID |
--with-apr | 指定 apr 程序的绝对路径 |
将其设置为开机启动
mv /root/httpd-2.4.41/build/rpm/httpd.init /etc/rc.d/init.d/httpd #从源码包移动脚本到启动目录
vim /etc/rc.d/init.d/httpd #修改以下内容
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
pidfile=${PIDFILE-/usr/local/apache2/logs/${prog}.pid}
CONFFILE=/usr/local/apache2/conf
#在/etc/rc.d/init.d目录下运行,以下命令
chkconfig --add httpd
chkconfig --level 2345 httpd on #设置为开机启动
chkconfig --list #可以看到httpd已经添加到开机启动,且2345为on
源码安装PHP
安装依赖
yum -y install libxml2 libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
安装PHP和所需模块
wget https://www.php.net/distributions/php-7.3.12.tar.gz
tar xf php-7.3.12.tar.gz
cd php-7.3.12
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-libxml-dir --with-curl --with-gd --with-openssl --enable-sockets --with-pear --enable-exif --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
make && make install
参数解释:https://blog.csdn.net/niluchen/article/details/41513217
如果PHP不解析,用以下方法
#在apache配置文件中添加以下信息,然后重启apache
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html
Centos7源码安装Apache和PHP的更多相关文章
- centos7源码安装Apache及Tomcat
源码安装Apache (1) 一.通过 https://apr.apache.org/ 下载 APR 和 APR-util 通过 http://httpd.apache.org/download.c ...
- 烂泥:源码安装apache
本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以 ...
- 源码安装apache
目标:源码安装apache 依赖包:apr.apr-util和pcre.其中pcre正则库要先安装,apr和apr-util(已解压)可以复制到apache下的资源库srclib下. 安装pcre: ...
- linux下源码安装apache服务
1.搭建静态网站是,我们只需要搭建apache服务即可满足要求. 例如:如果我再客户端游览器输入地址,他会找到192.168.1.100这个服务器,然后根据端口会找到apache服务器.apache他 ...
- centos7源码安装Python3的前提条件
centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...
- Linux 源码安装apache 与常见错误解决
文档原位置 一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级. 升级方式有两种,一种是通过源代码编译安装,一种是直接升 ...
- 源码安装Apache,报错:Cannot use an external APR with the bundled APR-util
一般在第一次源码安装是没有问题的,在版本变化情况下在次源码安装可能会遇到此问题: apache2.0.x与apache2.2.x在apr有很大区别,前者为依赖公用apr,后者依赖于自身的apr.一般前 ...
- centos7源码安装mysql5.7.19
centos7源码包安装mysql5.7 5.7.20安装方法和5.7.19的一样. 1.安装前准备 清空环境.安装相应的软件包 1>关闭防火墙和SELinux 2>配置yum源(阿里云, ...
- Centos7源码安装mysql及读写分离,互为主从
Linux服务器 -源码安装mysql 及读写分离,互为主从 一.环境介绍: Linux版本: CentOS 7 64位 mysq版本: mysql-5.6.26 这是我安装时所使用的版本, ...
随机推荐
- hdu 6141 I am your Father!
题 OvO http://acm.hdu.edu.cn/showproblem.php?pid=6141 (2017 Multi-University Training Contest - Team ...
- 开源笔记软件Joplin
Joplin is a free, open source note taking and to-do application, which can handle a large number of ...
- PHP mysqli_get_client_info() 函数
定义和用法 mysqli_get_client_info() 函数返回 MySQL 客户端库版本. <?php echo mysqli_get_client_info(); ?>
- 添加Mybatis
- luogu 2279 [HNOI2003]消防局的设立 树形dp
就是细节多一些,思路都非常常规. Code: #include <bits/stdc++.h> #define N 1005 #define inf 1061109567 #define ...
- Java基础语法n
BK 分段函数(SDUT 2257) import java.util.*; public class Main{ public static void main(String[] args ...
- 追本溯源:substr与substring历史漫话
引子: 很多时候,当我要字符串截取时,我会想到substr和substring的方法,但是具体要怎么传参数时,我总是记不住.哪个应该传个字符串长度,哪个又应该传个开始和结尾的下标,如果我不去查查这两个 ...
- Postgres copy命令导入导出数据
最近有需要对数据进行迁移的需求,由于postgres性能的关系,单表3000W的数据量查询起来有一些慢,需要对大表进行切割,拆成若干个子表,涉及到原有数据要迁移到子表的需求.起初的想法是使用存储过程, ...
- 2018-2019-2 20175226王鹏雲 实验四《Android程序设计》实验报告
2018-2019-2 20175226王鹏雲 实验四<Android程序设计>实验报告 实验报告封面 课程:Java程序设计 班级:1752班 姓名:王鹏雲 学号:20175226 指导 ...
- 解决Powershell中不能运行脚本问题
问题: powershell中不能执行脚本,提示‘because running scripts is disabled on this system’ 原因: powershell中默认的execu ...