centos7安装apache2.4.53+php8.1.3

学习目标:

centos7安装apache2.4.53+php8.1.3

学习内容

1.安装apache

1.安装必要依赖
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel
yum install libxml2-devel -y
yum install openssl openssl-devel
yum install bzip2 bzip2-devel -y yum install curl-devel -y
yum install libjpeg-devel -y
yum install libpng libpng-devel -y
yum install freetype-devel -y yum install libxslt-devel -y
yum install libzip-devel -y
yum install libxml2-devel
yum -y install autoconf automake libtool
yum install sqlite-devel
yum install expat-devel -y
git clone https://github.com/kkos/oniguruma 
cd oniguruma
./autogen.sh
./configure --prefix=/usr --libdir=/lib64
make && make install
2.下载apr-1.7.0
cd /opt
wgethttps://dlcdn.apache.org//apr/apr-1.7.0.tar.gz
tar -zxvf /opt/apr-1.7.0.tar.gz
make -p /usr/local/apr
cd /opt/apr-1.7.0
./configure --prefix=/usr/local/apr
make && make install

编译时报错
rm: cannot remove ‘libtoolT’: No such file or directory
参考
https://blog.csdn.net/weixin_44656934/article/details/90075806

3.下载apr-util-1.6.1
wget https://dlcdn.apache.org//apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
4.下载pcre

wget https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz
cd pcre2-10.39
make -p /usr/local/pcre
./configure --prefix=/usr/local/pcre
make && make install

5.下载apache包
wget https://dlcdn.apache.org/httpd/httpd-2.4.53.tar.gz
cd httpd-2.4.46
mkdir -p /usr/local/httpd
./configure --prefix=/usr/local/httpd/ --enable-shared=max--enable-module=rewirte --enable-module=so  --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
make && make install

执行make命令报错

libtool: error: cannot find the library ‘/usr/local/apr-util//lib/libapr-1.la’ or unhandled argument ‘/usr/local/apr-util//lib/libapr-1.la’

修复方案参考如下:
https://blog.netimed.cn/archives/Linux/20200212/207.html

2.安装php8.1.4

1.下载php8.1.4
wget  https://www.php.net/distributions/php-8.1.4.tar.gz
2.编译php8.1.4
cd  /opt/
tar -zxvf php-8.1.4.tar.gz
cd /opt/php8.1.4/php-8.1.4
3.编译前检查
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization  --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip  --with-config-file-path=/etc

编译安装

make && make install

centos7开放80端口
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值