Skip to content

Commit

Permalink
Merge pull request #1033 from seth-reeser/develop-catapult
Browse files Browse the repository at this point in the history
RedHat: Add PHP 7.3 support.
  • Loading branch information
seth-reeser authored Aug 7, 2022
2 parents 9149a77 + 15cf91f commit bb7be16
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ SilverStripe 3 | `silverstripe3` | 5.3.3 | 5.4 | June
SuiteCRM 7 | `suitecrm7` | 5.5 | 7.1 | October 21, 2013 | [November 15, 2019](http://support.sugarcrm.com/Resources/Supported_Versions/)
WordPress 4 | `wordpress4` | 5.2 | 7.1 | September 4, 2014 |
WordPress 5 | `wordpress5` | 5.6 | 7.2 | December 6, 2018 |
WordPress 6 | `wordpress6` | 5.6 | 7.2 | May 24, 2022 |
WordPress 6 | `wordpress6` | 5.6 | 7.3 | May 24, 2022 |
XenForo 1 | `xenforo1` | 5.2.11 | 5.4 | March 8, 2011 | [December 31, 2019](https://xenforo.com/community/threads/xenforo-1-5-end-of-life-schedule.157679/)
XenForo 2 | `xenforo2` | 5.4.0 | 7.1 | November 28, 2017 |
Zend Framework 2 | `zendframework2` | 5.3.23 | 5.4 | September 5, 2012 |
Expand All @@ -196,8 +196,9 @@ Catapult maintains a high level of integrity when it comes to PHP versions, thro
PHP Version | End-of-Life | Maintainer | Updater
------------|-------------|------------|--------
5.4 | June 30, 2024 | [CentOS](https://wiki.centos.org/FAQ/General#head-fe8a0be91ee3e7dea812e8694491e1dde5b75e6d) | [Red Hat](https://access.redhat.com/security/updates/backporting)
7.1 | December 1, 2019 | [SCLO](https://www.softwarecollections.org/en/scls/rhscl/rh-php71/) | [Red Hat](https://access.redhat.com/support/policy/updates/rhscl-rhel7)
7.2 | November 30, 2020 | [SCLO](https://www.softwarecollections.org/en/scls/rhscl/rh-php72/) | [Red Hat](https://access.redhat.com/support/policy/updates/rhscl-rhel7)
7.1 | December 1, 2019 | [Software Collections](https://www.softwarecollections.org/en/scls/rhscl/rh-php71/) | [Red Hat](https://access.redhat.com/support/policy/updates/rhscl-rhel7)
7.2 | November 30, 2020 | [Software Collections](https://www.softwarecollections.org/en/scls/rhscl/rh-php72/) | [Red Hat](https://access.redhat.com/support/policy/updates/rhscl-rhel7)
7.3 | June 30, 2024 | [Jan Staněk](https://www.softwarecollections.org/en/scls/jstanek/rh-php73/) | [Red Hat](https://access.redhat.com/support/policy/updates/rhscl-rhel7)

### End-of-Life (EOL) ###

Expand Down
2 changes: 1 addition & 1 deletion VERSION.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 4.4.1
version: 4.5.0
major:
description: "Catapult uses Semantic Versioning. During a MAJOR increment, incompatable API changes are made which require a manual upgrade path. Please follow these directions:"
notice: "NEW MAJOR VERSION OF CATAPULT AVAILABLE"
Expand Down
2 changes: 1 addition & 1 deletion provisioners/provisioners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ software:
database_config_file: "wp-config.php"
file_store_containers: ["wp-content"]
file_stores: ["wp-content/languages","wp-content/uploads"]
php_version: "7.2"
php_version: "7.3"
version: [6]
xenforo1:
repo: PRIVATE
Expand Down
8 changes: 7 additions & 1 deletion provisioners/redhat/modules/apache_vhosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ while IFS='' read -r -d '' key; do
force_https_hsts="# HSTS is only enabled when force_https=true"
fi
# handle the software php_version setting
if [ "${software_php_version}" = "7.2" ]; then
if [ "${software_php_version}" = "7.3" ]; then
software_php_version_value="
<FilesMatch \.php$>
SetHandler \"proxy:fcgi://127.0.0.1:9730\"
</FilesMatch>
"
elif [ "${software_php_version}" = "7.2" ]; then
software_php_version_value="
<FilesMatch \.php$>
SetHandler \"proxy:fcgi://127.0.0.1:9720\"
Expand Down
76 changes: 75 additions & 1 deletion provisioners/redhat/modules/php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,66 @@ source "/catapult/provisioners/redhat/modules/catapult.sh"
sudo yum remove -y *php56*
sudo yum remove -y *php70*

#################
# PHP 7.3 PHP_FPM
# /etc/opt/rh/rh-php73/php.ini
# /opt/rh/rh-php73/root/usr/bin/php
# /var/opt/rh/rh-php73/log/php-fpm
# sudo yum list \*-php73-\*
#################

# core extensions
sudo yum install -y rh-php73
# These are not actual extensions. They are part of the PHP core and cannot be left out of a PHP binary with compilation options.

# configure php-fpm
if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
sudo yum install -y rh-php73-php-fpm
sed -i -e "s#^listen = 127.0.0.1:9000#listen = 127.0.0.1:9730#g" /etc/opt/rh/rh-php73/php-fpm.d/www.conf
sudo systemctl enable rh-php73-php-fpm
sudo systemctl start rh-php73-php-fpm
fi

# php.ini configuration options
# set the timezone
sed -i -e "s#\;date\.timezone.*#date.timezone = \"$(catapult company.timezone_redhat)\"#g" /etc/opt/rh/rh-php73/php.ini
# increase the post_max_size
sed -i -e "s#^post_max_size.*#post_max_size = 64M#g" /etc/opt/rh/rh-php73/php.ini
# increase the upload_max_filesize
sed -i -e "s#^upload_max_filesize.*#upload_max_filesize = 16M#g" /etc/opt/rh/rh-php73/php.ini
# hide x-powered-by
sed -i -e "s#^expose_php.*#expose_php = Off#g" /etc/opt/rh/rh-php73/php.ini
# increase php memory limit for tools like composer
sed -i -e "s#^memory_limit.*#memory_limit = 256M#g" /etc/opt/rh/rh-php73/php.ini
# display errors on screen using the default recommendations for development and production
if ([ "$1" = "dev" ] || [ "$1" = "test" ]); then
sed -i -e "s#^display_errors.*#display_errors = On#g" /etc/opt/rh/rh-php73/php.ini
sed -i -e "s#^error_reporting.*#error_reporting = E_ALL#g" /etc/opt/rh/rh-php73/php.ini
else
sed -i -e "s#^display_errors.*#display_errors = Off#g" /etc/opt/rh/rh-php73/php.ini
sed -i -e "s#^error_reporting.*#error_reporting = E_ALL \& \~E_DEPRECATED \& \~E_STRICT#g" /etc/opt/rh/rh-php73/php.ini
fi

# bundled extensions
# These extensions are bundled with PHP.
sudo yum install -y rh-php73-php-bcmath rh-php73-php-gd rh-php73-php-intl rh-php73-php-mbstring rh-php73-php-opcache rh-php73-php-soap rh-php73-php-xmlrpc
# disable opcache for dev
if [ "$1" = "dev" ]; then
sudo bash -c 'echo "/var/www" > /etc/opt/rh/rh-php73/php.d/opcache-default.blacklist'
else
sudo bash -c 'echo "" > /etc/opt/rh/rh-php73/php.d/opcache-default.blacklist'
fi

# external extensions
# These extensions are bundled with PHP but in order to compile them, external libraries will be needed.
sudo yum install -y rh-php73-php-gmp rh-php73-php-mysqlnd

# pecl extensions
# https://blog.remirepo.net/post/2017/02/23/Additional-PHP-packages-for-RHSCL
curl --output /etc/yum.repos.d/rhscl-centos-release-scl-epel-7.repo wget https://copr.fedorainfracloud.org/coprs/rhscl/centos-release-scl/repo/epel-7/rhscl-centos-release-scl-epel-7.repo
# These extensions are available from » PECL. They may require external libraries. More PECL extensions exist but they are not documented in the PHP manual yet.
sudo yum install -y sclo-php73-php-pecl-imagick sclo-php73-php-pecl-uploadprogress

#################
# PHP 7.2 PHP_FPM
# /etc/opt/rh/rh-php72/php.ini
Expand Down Expand Up @@ -243,6 +303,10 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
sed --in-place --expression "s#newrelic\.appname.*#newrelic.appname = \"$(catapult company.name | tr '[:upper:]' '[:lower:]')-${1}-redhat\"#g" "/usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template"
sed --in-place --expression "s#;newrelic\.daemon.\port.*#newrelic.daemon.port = \"@newrelic-daemon\"#g" "/usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template"
sed --in-place --expression "s/\"REPLACE_WITH_REAL_KEY\"/\"$(catapult company.newrelic_license_key)\"/g" "/usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template"
# rh-php73
rm --force "/opt/rh/rh-php73/root/usr/lib64/php/modules/newrelic.so"
cp "/usr/share/newrelic/newrelic-php5-8.4.0.231-linux/agent/x64/newrelic-20170718.so" "/opt/rh/rh-php73/root/usr/lib64/php/modules/newrelic.so"
cp "/usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template" "/etc/opt/rh/rh-php73/php.d/newrelic.ini"
# rh-php72
rm --force "/opt/rh/rh-php72/root/usr/lib64/php/modules/newrelic.so"
cp "/usr/share/newrelic/newrelic-php5-8.4.0.231-linux/agent/x64/newrelic-20170718.so" "/opt/rh/rh-php72/root/usr/lib64/php/modules/newrelic.so"
Expand All @@ -253,7 +317,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
cp "/usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template" "/etc/opt/rh/rh-php71/php.d/newrelic.ini"

# new relic apm php installed but we need to set configuration
NR_INSTALL_PHPLIST="/usr/bin:/opt/rh/rh-php71/root/usr/bin:/opt/rh/rh-php72/root/usr/bin"; export NR_INSTALL_PHPLIST
NR_INSTALL_PHPLIST="/usr/bin:/opt/rh/rh-php71/root/usr/bin:/opt/rh/rh-php72/root/usr/bin:/opt/rh/rh-php73/root/usr/bin"; export NR_INSTALL_PHPLIST
NR_INSTALL_SILENT="true"; export NR_INSTALL_SILENT
NR_INSTALL_KEY="$(catapult company.newrelic_license_key)"; export NR_INSTALL_KEY
/usr/bin/newrelic-install install
Expand All @@ -262,6 +326,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
if [ -S /tmp/.newrelic.sock ]; then
sudo rm -f /tmp/.newrelic.sock
/etc/init.d/newrelic-daemon restart
sudo systemctl restart rh-php73-php-fpm
sudo systemctl restart rh-php72-php-fpm
sudo systemctl restart rh-php71-php-fpm
sudo systemctl restart php-fpm
Expand All @@ -279,6 +344,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
# cat /var/log/httpd/error_log* | grep Max

# look for php-fpm max errors
# cat /var/opt/rh/rh-php73/log/php-fpm/error.log* | grep max
# cat /var/opt/rh/rh-php72/log/php-fpm/error.log* | grep max
# cat /var/opt/rh/rh-php71/log/php-fpm/error.log* | grep max
# cat /var/log/php-fpm/error.log* | grep max
Expand Down Expand Up @@ -324,14 +390,20 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
# calculate configuration based on above values
# /catapult/provisioners/redhat/installers/php/configuration-calculator.xlsx

sed -i -e "s#^pm.max_children.*#pm.max_children = 300#g" /etc/opt/rh/rh-php73/php-fpm.d/www.conf
sed -i -e "s#^pm.max_children.*#pm.max_children = 300#g" /etc/opt/rh/rh-php72/php-fpm.d/www.conf
sed -i -e "s#^pm.max_children.*#pm.max_children = 300#g" /etc/opt/rh/rh-php71/php-fpm.d/www.conf
sed -i -e "s#^pm.max_children.*#pm.max_children = 300#g" /etc/php-fpm.d/www.conf

sed -i -e "s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/opt/rh/rh-php73/php-fpm.d/www.conf
sed -i -e "s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/opt/rh/rh-php72/php-fpm.d/www.conf
sed -i -e "s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/opt/rh/rh-php71/php-fpm.d/www.conf
sed -i -e "s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/php-fpm.d/www.conf

echo -e "\n> php 7.3 configuration"
/opt/rh/rh-php73/root/usr/bin/php --version
/opt/rh/rh-php73/root/usr/bin/php --modules

echo -e "\n> php 7.2 configuration"
/opt/rh/rh-php72/root/usr/bin/php --version
/opt/rh/rh-php72/root/usr/bin/php --modules
Expand All @@ -345,6 +417,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
/usr/bin/php --modules

# reload php-fpm for configuration changes to take effect
sudo systemctl reload rh-php73-php-fpm
sudo systemctl reload rh-php72-php-fpm
sudo systemctl reload rh-php71-php-fpm
sudo systemctl reload php-fpm
Expand All @@ -355,6 +428,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
# cat /var/log/httpd/error_log
# [Tue Dec 26 21:06:23.816950 2017] [mpm_prefork:notice] [pid 792] AH00171: Graceful restart requested, doing restart
# [Tue Dec 26 21:06:24.648573 2017] [core:notice] [pid 792] AH00060: seg fault or similar nasty error detected in the parent process
sudo systemctl start rh-php73-php-fpm
sudo systemctl start rh-php72-php-fpm
sudo systemctl start rh-php71-php-fpm
sudo systemctl start php-fpm
Expand Down
23 changes: 23 additions & 0 deletions provisioners/redhat/modules/software_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ source ~/.bashrc
composer-php72 --version


echo "> configuring composer-php73"
# configure php version
if ! grep -q "alias composer-php73='/opt/rh/rh-php73/root/usr/bin/php /usr/local/src/composer/composer.phar'" ~/.bashrc; then
sudo bash -c "echo -e \"\nalias composer-php73='/opt/rh/rh-php73/root/usr/bin/php /usr/local/src/composer/composer.phar'\" >> ~/.bashrc"
fi
# expose the alternate software tool version aliases
shopt -s expand_aliases
source ~/.bashrc
# output the version
composer-php73 --version


echo "> configuring drush"
if [ ! -f /usr/bin/drush ]; then
mkdir --parents /usr/local/src/drush
Expand Down Expand Up @@ -117,3 +129,14 @@ shopt -s expand_aliases
source ~/.bashrc
# output the version
wp-cli-php72 --allow-root cli version


echo "> configuring wp-cli-php73"
if ! grep -q "alias wp-cli-php73='/opt/rh/rh-php73/root/usr/bin/php /usr/local/src/wp-cli/wp-cli.phar'" ~/.bashrc; then
sudo bash -c "echo -e \"\nalias wp-cli-php73='/opt/rh/rh-php73/root/usr/bin/php /usr/local/src/wp-cli/wp-cli.phar'\" >> ~/.bashrc"
fi
# expose the alternate software tool version aliases
shopt -s expand_aliases
source ~/.bashrc
# output the version
wp-cli-php73 --allow-root cli version

0 comments on commit bb7be16

Please sign in to comment.