源码编译安装PHP和Apache(解决php通过yum安装版本低的问题)

1  Centos 编译安装 Apache 准备:     
   yum groupinstall "Development tools"

之前服务器是 yum install httpd 安装的 Apache,所以可能解决了部分依赖关系,在我编译安装的过程中,只需要再格外 yum 两个 devel 包:
        yum install zlib-devel pcre-devel

2 从官方下载httpd:
    通过wget下载  
    wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.29.tar.gz      
  wget http://mirror.bit.edu.cn/apache/apr/apr-util-0.9.19.tar.gz      
  wget http://mirror.bit.edu.cn/apache/apr/apr-0.9.20.tar.gz
解压缩:
        tar -xvf httpd-2.2.29.tar.gz
        tar -xvf apr-0.9.20.tar.gz
        tar -xvf apr-util-0.9.19.tar.gz
执行文件操作:
        mv apr-0.9.20 httpd-2.2.29/srclib/apr
        mv apr-util-0.9.19 httpd-2.2.29/srclib/apr-util
        cd httpd-2.2.29

3 编译命令:
        ./configure --with-included-apr --enable-nonportable-atomics=yes --with-z




4. 执行编译操作


make & make install


5. 删除原有的httpd并添加刚编译完毕的httpd


service httpd stop 


yum remove httpd


cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd


编辑 /etc/init.d/httpd 文件,在首行 #!/bin/sh 下面加入两行:
# chkconfig: 35 85 15
# description: Activates/Deactivates Apache 2.4.6
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值