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.gzwget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gztar xf apr-1.7.0.tar.gztar xf apr-util-1.6.1.tar.gzcd apr-1.7.0./configuremake && make installcd ..cd apr-util-1.6.1./configure --with-apr=/usr/local/apr/make && make installcd ..

安装Apache服务和模块

wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.41.tar.gztar xf httpd-2.4.41.tar.gzcd 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 installvim /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 httpdchkconfig --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.gztar xf php-7.3.12.tar.gzcd 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=mysqlndmake && make install

参数解释:https://blog.csdn.net/niluchen/article/details/41513217

如果PHP不解析,用以下方法

#在apache配置文件中添加以下信息,然后重启apacheAddType application/x-httpd-php .phpDirectoryIndex index.php index.html

原文地址:https://www.cnblogs.com/wintrysec/p/11963789.html

时间: 2024-08-01 10:53:43

Centos7源码安装Apache和PHP的相关文章

centos7源码安装apache

安装软件:a. httpd官方网站/下载地址: http://httpd.apache.org/download.cgi 或 https://github.com/dollarphper/soft/raw/master/apache/httpd-2.4.34.tar.gz b. arp.arp-util官方网站: http://apr.apache.org/download.cgi 或 https://github.com/dollarphper/soft/raw/master/apache/a

烂泥:源码安装apache

本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以下步骤进行安装apache: 1. 安装编译环境 2. 卸载原有apache 3. 下载解压源码包 4. 安装apache 5. 测试apache 6. 查看apache安装生成的目录 7. 查看apache的配置文件 8. apache加入系统服务 一.安装编译环境 在安装apache之前,我们需

LAMP配置笔记之源码安装apache

下载Apache源码: http://httpd.apache.org/(当前最新版本为2.4.12) tar -xf http-xx.tar cd http-xx ./configure --enable-so          //另外还可以使用 --prefix=path 指定安装位置,默认安装位置为: /usr/local/apache2/ ,完整的配置选项参考官方文档:http://httpd.apache.org/docs/2.4/programs/configure.html ma

源码安装Apache,报错:Cannot use an external APR with the bundled APR-util和httpd: Could not reliably determine the server's fully qualified domain name

一.解决APR和APR-util错误: 1.1.安装APR: [[email protected] httpd-2.2.23]# cd srclib/apr [[email protected] apr]# ./configure --prefix=/usr/local/apr root@ganglia apr]# make && make install 1.2.安装APR-util: [[email protected] apr]# cd ../apr-util/ [[email pr

CentOS 7.4下源码安装 Apache HTTP Server(httpd-2.4.35)

CentOS 7.4下源码安装 Apache HTTP Server(httpd-2.4.35) 前提:确保安装了expat-devel, APR包 (apr-1.6.3.tar.gz 和 apr-util-1.6.1.tar.gz); 用YUM方式安装expat-devel 和 apr-util-devel yum -y install expat-devel yum -y install apr-util-devel 解压apr-1.6.3.tar.gz后进入该目录下,执行: ./confi

源码安装 apache 2.4.27

登陆apache官网下载源码安装包 http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.27.tar.gz 下载所需软件源码包 § Apache Apr: http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.2.tar.gz Apr-Util: http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.0.tar.gz (或者点

Linux 源码安装apache 与常见错误解决

文档原位置 一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级. 升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包(谨慎!小心).下面是使用源代码的方式行,它们的下载路径为:(~_~)这里不再说到那里下载了,相信你有能力找的到的,呵呵 2.安装依赖的软件包(当然这里可以认为成需要的编译环境咯!) yum -y install pcre-devel yum -y install  "Developmen

Centos 7.0 编译安装LAMP(Linxu+apache+mysql+php)之源码安装Apache (一)

Apache 简介: Apache是世界使用排名第一的Web服务器软件.它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一.它快速.可靠并且可通过简单的API扩充,将Perl/Python等解释器编译到服务器中. 安装环境: 系统: centos 7.0 最小化安装 软件:httpd-2.4.26 依赖包:apr .apr-util .pcre .gcc .gcc-c++ .perl-dvel.perl.openssl .openssl-

Centos7源码安装mysql

转子 http://www.linuxidc.com/Linux/2015-06/119354.htm 目录 准备工作 运行环境 确认你的安装版本 下载MySQL 安装MySQL 准备安装环境 编译和安装 配置MySQL 单实例配置 单实例配置方法 添加防火墙 启动MySQL 重启MySQL 多实例配置 什么是多实例 多实例配置方法 创建启动文件 初始化数据库 配置防火墙 启动MySQL 登陆MySQL 重启MySQL 准备工作 运行环境 本文的运行环境如下 系统版本 CentOS7最小化安装: