Skip to main content

Upgrading to PHP 7.4 on CentOS

This document provides high-level guidance to customers that undertake their own hosting and management of Jadu software running on a LAMP (Linux, Apache, MySQL, PHP) server software stack and wish to undertake an upgrade to PHP 7.4, MariaDB 10.5.

This document provides guidance to system administrators, and is not intended as a universal step by step guide - if such a level of support is required, please contact Jadu for a professional services quotation.

Overall approach

In order to upgrade PHP to version 7.4 the server must be running Centos 7. If you require assistance with upgrading to CentOS 7 from CentOS 6, please contact us first.

The upgrade will be in-place, and will require some amount of service downtime.

The upgrade process will first remove the old packages from the system, before installing the new ones from a repository. Configuration changes are made and the services are started.

You must take a full backup of the system before actioning these changes, and be prepared to restore if necessary.

The shell commands in this guide assume the use of the Bash shell as root.

Note 1: This document assumes you are using the IUS yum repository for PHP packages, hence PHP 7.2 packages will reference package names php72u-... etc. If this is not the case, please adjust the instructions to suit your environment.

Note 2: At the time this document was created (July 2021) Jadu software does not support PHP versions above 7.4, MariaDB versions above 10.5 or CentOS versions above 7.

1. Upgrade PHP

Step 1. Stop Apache and PHP-FPM

systemctl stop httpd php-fpm

Step 2. Obtain and verify a list of installed PHP 7.2 packages

yum list installed 'php72u-*' 2> /dev/null | awk '/php72u/ { print $1 }' | tee ~/php72-modules.txt

Step 3. Remove PHP 7.2 components.

yum remove $(< ~/php72-modules.txt)

Step 4. Install PHP 7.4 components.

yum install $(sed 's/php72u/php74/g' ~/php72-modules.txt)

2. Upgrade MariaDB

Step 1. Stop MariaDB

systemctl stop mariadb

Step 2. Backup old MariaDB configuration

mkdir ~/mysql_backup && cp -R /etc/my.cnf /etc/my.cnf.d ~/mysql_backup

Step 3. Remove existing MariaDB packages

yum remove 'mariadb-5*' 'mariadb-server'

Step 4. Install the MariaDB 10.5 repository, following the instructions on the MariaDB website

Step 5. Install MariaDB 10.5 packages

yum install MariaDB-{client,common,compat,server}

Step 6. Restore old configuration

\cp -R ~/mysql_backup/* /etc/

Step 7. Add performance-enhancing configuration. Place the following pastebin content in /etc/my.cnf.d/jadu-performance.conf.

3. Final tasks

Step 1. Start LAMP services:

systemctl start httpd mariadb php-fpm

Step 2. Run mysql_upgrade:

mysql_upgrade

Step 3. Verify successful upgrade:

php -v
mysql -V