CentOS7编译安装httpd-2.4.41 php7.3
Posted 纵马疾驰
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7编译安装httpd-2.4.41 php7.3相关的知识,希望对你有一定的参考价值。
CentOS7编译安装httpd-2.4.41 php7.3
安装参考环境:
CentOS Linux release 7.5.1804 (Core)
一、安装依赖包
httpd安装的依赖包
# yum -y install pcre-devel
# yum -y install openssl-devel
# yum -y groupinstall "Development Tools"
arp-util安装的依赖包
# yum install expat-devel
二、编译安装apr-1.7.0
# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.g
# tar xf apr-1.7.0.tar.gz
# cd apr-1.7.0
# ./configure -prefix=/usr/local/apr
# make && make install
三、编译安装apr-util-1.6.1
# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
# tar xf 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
四、编译安装httpd-2.4.41
# wget http://mirror.bit.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/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modeles=most --enable-mpms-shared=all --with-mpm=event
# make && make install
五、添加httpd服务开启启动
1、用chkconfig 方式管理
ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
vi /etc/rc.d/init.d/httpd
#在#/bin/sh 下加上两行
# chkconfig: 2345 95 10
# description: Activates/Deactivates Apache Web Server
#注册服务
chkconfig --add httpd
#开机自启动
systemctl enable httpd | chkconfig httpd on
#管理
service httpd stop|start|restart
六、启动httpd
# /usr/local/apache/bin/httpd
七、创建apache用户组
useradd -U apache
八、修改httpd.conf 配置文件
ps -aux | grep apache //源码编译apache,运行用户为deamon
#修改配置文件改变apache运行身份
[root@promote conf]# vim httpd.conf
User apache
Group apache
# #添加php支持
[root@promote conf]# vim httpd.conf
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
##添加解析php类别文件
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
九、安装PHP所需依赖软件。
yum -y install libxml2-devel openssl curl-devel libjpeg-devel libpng libpng-devel freetype-devel libmcrypt-devel libzip libzip-devel
十、编译和安装。需要注意一下,Apache怎么和PHP互动?
./configure --prefix=/usr/local/php7.3 --with-config-file-path=/usr/local/php7.3/etc --enable-fpm --enable-sysvsem --enable-sockets --enable-pcntl --enable-mbstring --enable-mysqlnd --enable-opcache --enable-shmop --enable-ftp --enable-wddx --enable-soap --with-apxs2=/usr/local/apache/bin/apxs
修改配置文件
cp php.ini-production /usr/local/php7.3/etc/php.ini
ls /usr/local/php7.3/etc/
vi /usr/local/php7.3/etc/php.ini
#禁用函数
disable_functions=
以上是关于CentOS7编译安装httpd-2.4.41 php7.3的主要内容,如果未能解决你的问题,请参考以下文章