linux apache oracle php_Linux+php+apache+oracle环境搭建之CentOS下安装Apache

本文详细介绍了在CentOS系统上安装Apache时,由于缺失APR、APR-Util和PCRE组件而进行的完整安装过程,包括下载、配置和编译步骤,以及如何解决编译错误和设置Apache开机自启。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CentOS系统安装的是Basic Server。安装apache之前所必须的缺少的组件比较多,下面罗列下本次需要安装的组件

apache - aprapache - apr-utilperl - pcreapache

官网下载Apache,下载地址:http://httpd.apache.org/download.cgi

下载稳定版本httpd-2.4.9.tar.gz,上传到服务器/usr/packages目录下。

安装Apache:

# tar -xvzf httpd-2.4.9.tar.gz

# cd httpd-2.4.9

# ./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite

检查编译环境报错:

checking for APR... no

configure: error: APR not found . Please read the documentation.

原因缺少APR(Apache Portable Runtime),需要下载apr与apr-util。

下载地址:http://apr.apache.org/download.cgi

下载apr-1.5.1.tar.gz、apr-util-1.5.3.tar.gz

安装apr:

# tar -xvzf apr-1.5.1.tar.gz

# cd apr-1.5.1

# .configure

# make

# make install

安装apr-util:

# tar -xvzf apr-util-1.5.3.tar.gz

# cd apr-util-1.5.3

# .configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

# make

# make install

再次检查编译环境报错:

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

缺少pcre,下载地址:http://sourceforge.net/projects/pcre/

安装pcre:

# unzip -o pcre-8.35

# cd pcre-8.35

# ./configure --prefix=/usr/local/pcre

# make

# make install

再次检查编译环境时加上参数:

--with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre

没有报错:

# make

# make install

安装完毕。

这是我第一次安装,缺少关联关系的组件,下次安装直接先安装组件,最后安装apache,这样会顺畅些吧。

启动Apache

# cp /usr/local/apache/bin/apachectl /sbin/

# apachectl start

配置随系统启动时启动Apache服务

# vi /etc/rc.d/rc.local

在最后一行加上: /sbin/apachectl start

修改Apache默认站点目录

修改/usr/local/apache/conf/httpd.conf文件

23e956bebceb67772652d11904f5792d.png

改成

37c92c1ed4ad22e03f47ceae5cea6913.png

执行命令

# apachectl restart

Apache的配置文件再续~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值