首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用SCL更新Apache和PHP?

如何使用SCL更新Apache和PHP?
EN

Unix & Linux用户
提问于 2017-12-20 21:28:51
回答 1查看 9.7K关注 0票数 1

我正在使用SCLs测试PHP的升级。测试是在一个本地VM上进行的,所以在我们开发一个过程时,打破一些东西是可以的。在SCL存储库之后,我能够将Python更新为2.7.13,并通过profiles.d/激活它。我现在正试图升级Apache和PHP。

根据Apache下载,最新的版本是Apache2.4.29。当我尝试用yum install httpd更新Apache时,我被告知httpd-2.4.6-67.el7.centos.6.x86_64包已经安装,并且是最新的。如果我使用yum install httpd24,那么SCL将尝试安装Apache1.18。

yum search httpd没有那么大的帮助。它列出了包(有时还会注意到SCL),但缺少版本号。

如何在使用SCL程序时安装最新的Apache和PHP?

EN

回答 1

Unix & Linux用户

发布于 2017-12-21 05:06:47

以下是我对Apache、Python和PHP升级的字段说明。它还包括mod_ssl,但缺少mod_security。我在SCL中找不到mod_security

代码语言:javascript
复制
##################################################
# https://access.redhat.com/solutions/527703
# https://www.hogarthuk.com/?q=node/15
# https://developers.redhat.com/blog/2014/03/19/permanently-enable-a-software-collection/

##################################################
# Enable SCL
##################################################
yum -y install centos-release-scl
yum-config-manager --enable rhel-server-rhscl-7-rpms

##################################################
# Python 2.7
##################################################
yum -y install python27

# Add enable-scl-python27.sh
cat /etc/profile.d/enable-scl-python27.sh
#!/usr/bin/env bash
source scl_source enable python27

##################################################
# PHP 7.1
##################################################
yum -y install rh-php71 rh-php71-php rh-php71-ssl rh-php71-php-mysqlnd

# Config at /etc/opt/rh/rh-php71/php.ini

# Add enable-scl-php71.sh
cat /etc/profile.d/enable-scl-php71.sh
#!/usr/bin/env bash
source scl_source enable rh-php71

##################################################
# Apache 2.4
##################################################
yum -y install httpd24
yum -y install httpd24-httpd-tools httpd24-mod_php httpd24-mod_ssl

# Add enable-scl-php71.sh
cat /etc/profile.d/enable-scl-httpd24.sh
#!/usr/bin/env bash
source scl_source enable httpd24

# Disable old, enable new
systemctl disable httpd.service
systemctl enable httpd24-httpd.service

# Config at /opt/rh/httpd24/root/etc/httpd/httpd.conf
#        or /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf

# Config at /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf

##################################################
# httpd-ssl-pass-dialog

# The original ssl.conf probably includes this:
# SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog

# Change it to this:
# /opt/rh/httpd24/root/usr/libexec/httpd-ssl-pass-dialog

##################################################
# !!! TEST APACHE !!!
apachectl configtest

# ps -aux | egrep 'apache|http'
root      1424  0.1  1.2 319644 13376 ?        Ss   00:54   0:00 /opt/rh/httpd24/root/usr/sbin/httpd -DFOREGROUND
apache    1425  0.0  0.8 361184  8400 ?        Sl   00:54   0:00 /opt/rh/httpd24/root/usr/sbin/httpd -DFOREGROUND
...

##################################################
# Backup fresh CONF
##################################################
cp /etc/opt/rh/rh-php71/php.ini /etc/opt/rh/rh-php71/php.ini.bu
cp /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf.bu
cp /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf.bu

##################################################
# Copy old CONF to new CONF
##################################################
# Copy httpd.conf and ssl.conf from /etc/httpd to /opt/rh/httpd24/root/etc/httpd
# Change SERVER_ROOT from /etc/httpd to /opt/rh/httpd24/root/etc/httpd
# Leave DOCUMENT_ROOT unchanged. The new server can serve from the old location.
# Leave mod_ssl unchanged. The old and new mod_ssl use /etc/pki/tls/certs and /etc/pki/tls/private.
# php.ini is too different between version 5 and version 7. Manually copy the hardening.

##################################################
# Hardening
##################################################
# List unneeded functions from PHP in disable_functions
# Comment unneeded modules in /opt/rh/httpd24/root/etc/httpd/conf.modules.d

##################################################
# Important Diff's after cp
##################################################
diff /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf.bu /opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf
diff /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf.bu /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf
票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/412122

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档