• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

CentOS7编译安装httpd-2.4.41php7.3

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

安装参考环境:

  CentOS Linux release 7.5.1804 (Core)

一、安装依赖包

[](javascript:void(0)????

httpd安装的依赖包
# yum -y install pcre-devel                  
# yum -y install openssl-devel 
# yum -y groupinstall "Development Tools"  

arp-util安装的依赖包
# yum install expat-devel     

[](javascript:void(0)????

二、编译安装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

[](javascript:void(0)????

# 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

[](javascript:void(0)????

五、添加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=



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP实现自定义中奖和概率算法发布时间:2022-07-10
下一篇:
PHP遍历数组元素发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap