What breaks when you leave CentOS 7, and how to fix it
CentOS 7 reached end of life in June 2024. This guide covers the breaking changes you will hit on AlmaLinux 9 and Ubuntu 24.04, including PHP 8 errors, database authentication mismatches, Apache and PHP-FPM configuration, firewall rules, and SELinux policies. Learn how to plan your migration and correct each issue.
What breaks when you leave CentOS 7, and how to fix it
Leaving CentOS 7 moves you to newer defaults that behave differently. The most common breakages are PHP 8 errors, database authentication and version mismatches, Apache expecting PHP-FPM instead of mod_php, firewall rules failing, and SELinux or TLS policies blocking things that used to work. This guide explains the changes you will hit on AlmaLinux 9 and Ubuntu 24.04 and how to correct them.
This picks up from a server you can already reach over SSH. If you run on a Hostworld VPS, you can rebuild to AlmaLinux 9 or Ubuntu 24.04 in Virtualizor from the client area, or mount an ISO for a clean install.
Before you start
- CentOS 7 reached end of life on 30 June 2024. Security fixes are not provided upstream any more. Plan a move rather than staying put.
- Back up your databases before you start. Starting MySQL 8.0 or newer MariaDB on old data without a tested backup can make rollback impossible. MySQL 8.0 does not support in-place downgrades to 5.7. Take a physical backup and a logical dump before the first start on the new version.
- Choose one database engine on AlmaLinux 9. RHEL/AlmaLinux 9 provides MariaDB by default. MySQL and MariaDB packages conflict on that platform and cannot be installed in parallel.
- Expect PHP to move to 8.x. Old PHP 5.x or 7.x code can break. PHP 8.0 introduces backward-incompatible changes and PHP 8.2 deprecates dynamic properties.
- Expect Apache to run PHP via PHP-FPM. mod_php is not available on AlmaLinux 9. Your virtual hosts must point to the correct PHP-FPM socket.
- Expect firewall and SELinux/AppArmor changes. AlmaLinux 9 uses firewalld with nftables and SELinux. Ubuntu 24.04 uses nftables and AppArmor. Old iptables scripts and SELinux-unaware setups will fail.
- Expect system tooling changes. AlmaLinux 9 uses dnf. Network-scripts (ifcfg-*) are gone and NetworkManager is required. OpenSSL 3 is the default on both platforms and disables legacy ciphers and TLS 1.0/1.1.
If you need help planning the exact order of operations for your Hostworld VPS or server, open a support ticket and we will review your stack and app versions.
Step 1: Map your CentOS 7 stack to AlmaLinux 9 or Ubuntu 24.04
On AlmaLinux 9, check which PHP streams and database packages you will land on. This tells you the target versions you need to test against.
AlmaLinux 9 — this lists the available PHP module streams so you can see 8.0, 8.1 and 8.2:
dnf module list php
AlmaLinux 9 — this shows details of the MariaDB server package in the base Application Stream:
dnf info mariadb-server
On Ubuntu 24.04, confirm that PHP 8.3 and MySQL 8.0 are the defaults so you can plan your upgrades.
Ubuntu 24.04 — this shows the installed and candidate versions of PHP 8.3 packages:
apt policy php8.3
Ubuntu 24.04 — this confirms MySQL 8.0 is the default server package:
apt policy mysql-server-8.0
Step 2: Prepare for PHP 8 and PHP-FPM
What changes and why it breaks:
- PHP 8.0 introduces stricter type behaviour and engine changes. Code that worked on 5.x or 7.x can fatally error until updated.
- PHP 8.2 deprecates dynamic properties. Code that sets undeclared properties will emit deprecations now and will error in PHP 9.
- ext/mcrypt is not bundled since PHP 7.2. Apps that rely on it need to use alternatives.
- On AlmaLinux 9, mod_php is not available. Apache must talk to PHP-FPM using proxy_fcgi.
- Package names differ by distro. The MySQL driver for PHP is php-mysqlnd on AlmaLinux and php8.3-mysql on Ubuntu 24.04. Mixing names leads to failed installs.
Install the right PHP packages on the target OS so you can test your code against the new runtime.
AlmaLinux 9 — this enables the PHP 8.1 stream and installs PHP, PHP-FPM and the MySQL native driver so Apache or Nginx can execute PHP and connect to databases:
dnf module enable php:8.1 -y
dnf install -y php php-fpm php-mysqlnd
Ubuntu 24.04 — this installs PHP 8.3 FPM and the PHP MySQL driver so PHP-FPM is available and PHP can talk to MySQL:
apt update
apt install -y php8.3-fpm php8.3-mysql
Find the PHP-FPM socket path and use it in your web server configuration. The default paths differ by OS.
AlmaLinux 9 — this prints the listen directive from the default PHP-FPM pool so you can see the socket path (usually /run/php-fpm/www.sock):
grep ^listen /etc/php-fpm.d/www.conf
Ubuntu 24.04 — this prints the listen directive from the default PHP-FPM pool so you can see the socket path (usually /run/php/php8.3-fpm.sock):
grep ^listen /etc/php/8.3/fpm/pool.d/www.conf
Update Apache or Nginx to use that exact socket. If you point Apache to the wrong path, it will stop executing PHP and may offer your code for download. If you point Nginx to the wrong socket, it will return 502 errors.
Audit your application for PHP 8 changes before the cutover. Read and act on the official PHP 8.0 migration guide, and check for dynamic property use ahead of PHP 8.2. Replace any use of mcrypt with supported alternatives.
Step 3: Plan for MySQL 8.0 or MariaDB 10.5
What changes and why it breaks:
- Ubuntu 24.04 installs MySQL 8.0 by default. Its default authentication plugin is caching_sha2_password. Older connectors that do not support it will fail to connect until upgraded or the account is changed.
- RHEL/AlmaLinux 9 provides MariaDB 10.5 in the base Application Stream. Newer MariaDB is available as an upgrade path. MySQL and MariaDB packages on RHEL/AlmaLinux 9 conflict and cannot be installed together.
- MySQL 8.0 does not support in-place downgrades to 5.7. If you start 8.0 on data and then decide to go back, you will need a tested backup and likely a logical dump to restore.
- Client libraries differ. On RHEL/AlmaLinux, the MariaDB Connector/C replaces libmysqlclient in packages. Most apps work, but edge cases or plugins might need an updated connector.
- Configuration file locations differ. On Ubuntu, mysqld.cnf lives under /etc/mysql/mysql.conf.d. On AlmaLinux/RHEL, server configs live under /etc/my.cnf.d.
Check which server and client you are running on the new OS so you can align your expectations and testing.
AlmaLinux 9 — this prints the version string from the MySQL/MariaDB client so you can see the server family and version when connected:
mysql --version
Ubuntu 24.04 — this prints the version string from the MySQL client so you can confirm MySQL 8.0 tooling:
mysql --version
Back up your databases before you start or upgrade any new server. A logical dump gives you a rollback option if a connector or authentication change surprises you.
AlmaLinux 9 — this creates a logical dump of all databases to a file in your home directory:
mysqldump --all-databases > ~/alldbs-backup.sql
Ubuntu 24.04 — this creates a logical dump of all databases to a file in your home directory:
mysqldump --all-databases > ~/alldbs-backup.sql
If legacy applications cannot be upgraded immediately to a connector that supports caching_sha2_password, adjust the MySQL 8.0 account to a plugin they support while you plan an update. Changing the account’s authentication method is a workaround you can use per user until drivers are updated.
Find key server settings in the right config path for your platform so you can carry forward items such as bind-address.
AlmaLinux 9 — this searches MariaDB server config snippets for a bind-address or port so you can migrate the setting:
grep -R -E '^(bind-address|port)' /etc/my.cnf.d/
Ubuntu 24.04 — this searches the MySQL server config directory for a bind-address or port so you can migrate the setting:
grep -R -E '^(bind-address|port)' /etc/mysql/mysql.conf.d/
Choose one server engine on AlmaLinux 9. If you decide to switch between MySQL and MariaDB, plan a clean dump and restore rather than trying to swap packages in place. Mixing the two on AlmaLinux 9 leads to conflicts and service confusion.
Step 4: Update Apache to match your new OS and PHP-FPM
What changes and why it breaks:
- Service names differ. On AlmaLinux/RHEL the service is httpd. On Ubuntu it is apache2. Use the right systemd unit name.
- Directory layouts differ. AlmaLinux uses /etc/httpd with conf.d includes. Ubuntu uses /etc/apache2 with sites-available and sites-enabled plus helper tools.
- On AlmaLinux 9 there is no mod_php. Apache must be configured to talk to PHP-FPM using proxy_fcgi, and the socket path must match your PHP-FPM pool.
Locate your Apache configuration so you can move virtual hosts to the correct layout.
AlmaLinux 9 — this lists the Apache include directory so you can see which files are loaded:
ls -1 /etc/httpd/conf.d/
Ubuntu 24.04 — this lists the virtual host definitions that Ubuntu’s a2ensite/a2dissite manage:
ls -1 /etc/apache2/sites-available/
Restart Apache with the correct service name after updating its configuration to point to the PHP-FPM socket you found in Step 2.
AlmaLinux 9 — this restarts Apache so your changes take effect:
systemctl restart httpd
Ubuntu 24.04 — this restarts Apache so your changes take effect:
systemctl restart apache2
Step 5: Migrate firewall rules to nftables and firewalld/ufw
What changes and why it breaks:
- AlmaLinux 9 uses firewalld with nftables. Old iptables scripts will not apply as-is.
- Ubuntu 24.04 uses nftables by default. ufw still works, but iptables-legacy is no longer the default.
- A misapplied rule set can block SSH or web and lock you out. Translate rules before you cut over.
Open HTTP and HTTPS on the new platform in the native firewall so your sites remain reachable.
AlmaLinux 9 — this adds HTTP and HTTPS services permanently and reloads firewalld to apply the changes:
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --reload
Ubuntu 24.04 — this allows HTTP and HTTPS through ufw and then shows status so you can confirm the rules are loaded:
ufw allow 80/tcp
ufw allow 443/tcp
ufw status
Step 6: Allow web-to-database connections with SELinux or AppArmor
What changes and why it breaks:
- AlmaLinux 9 ships with SELinux enforcing. By default, Apache may be blocked from opening outbound network connections to a database. You need to set the right boolean to allow it.
- Ubuntu 24.04 uses AppArmor, not SELinux. SELinux commands such as setsebool do not apply.
Enable the relevant SELinux permissions on AlmaLinux 9 if your PHP app reaches out to a database or API.
AlmaLinux 9 — these commands allow Apache to make outbound connections and persist the change. Use the database-specific boolean if your app connects to a database service:
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_connect_db on
Ubuntu 24.04 — AppArmor profiles control Apache. Review and adjust the profile for your web server if outbound connections are denied. SELinux tools such as setsebool are not available.
Step 7: Recreate network configuration with NetworkManager (AlmaLinux)
What changes and why it breaks:
- RHEL 9 removed the legacy network-scripts. Carrying over ifcfg-* files from CentOS 7 will not work.
List connections so you can see what NetworkManager considers active, then recreate static addressing using NetworkManager rather than copying old files.
AlmaLinux 9 — this shows all NetworkManager connections so you can plan any edits:
nmcli connection show
Ubuntu 24.04 — Netplan and NetworkManager manage networking. Do not copy CentOS 7 ifcfg files to Ubuntu 24.04.
Step 8: Account for OpenSSL 3 and TLS policy
What changes and why it breaks:
- Both AlmaLinux 9 and Ubuntu 24.04 use OpenSSL 3.x. Some legacy algorithms are disabled by default and OpenSSL now uses Providers.
- Ubuntu 24.04 disables TLS 1.0 and 1.1 by default. Old clients or servers that only support those protocols will fail handshakes until upgraded or reconfigured.
Check your OpenSSL version so you know which policy applies, and be ready to update code or libraries that depend on deprecated APIs or ciphers.
AlmaLinux 9 — this prints the OpenSSL version so you can confirm you are on 3.x:
openssl version
Ubuntu 24.04 — this prints the OpenSSL version so you can confirm you are on 3.x:
openssl version
Step 9: Update Python and automation assumptions
What changes and why it breaks:
- Python 2 is not shipped in RHEL 9 and an unversioned /usr/bin/python is not present unless installed. Use python3 explicitly.
- Ubuntu 24.04 does not include /usr/bin/python by default. The python-is-python3 package provides a convenience symlink if you need scripts to call python.
- yum is a compatibility wrapper in RHEL 9. dnf is the package manager you should prefer in scripts.
Confirm Python availability so you know what your automation can call.
AlmaLinux 9 — this installs Python 3 if it is missing and shows the version so you can update shebangs and scripts:
dnf install -y python3
python3 --version
Ubuntu 24.04 — this installs the python-is-python3 symlink so scripts that call python work, then shows the version:
apt update
apt install -y python-is-python3
python --version
Prefer dnf in new automation on AlmaLinux 9 even though yum still exists as a symlink.
AlmaLinux 9 — this checks for available updates using dnf so you can align your scripts with the current tool:
dnf check-update
Step 10: Validate services end to end
Run quick checks so you can catch the obvious problems before moving traffic.
AlmaLinux 9 — these commands show your PHP version and confirm the PHP MySQL driver is installed:
php -v
php -m | grep -i mysql
Ubuntu 24.04 — these commands show your PHP version and confirm the PHP MySQL driver is installed:
php -v
php -m | grep -i mysql
AlmaLinux 9 — this asks the database for its version so you can confirm the server is reachable and responding:
mysql -e "SELECT VERSION();"
Ubuntu 24.04 — this asks the database for its version so you can confirm the server is reachable and responding:
mysql -e "SELECT VERSION();"
When you are happy, schedule your cutover. If you are using a Hostworld VPS, you can rebuild to AlmaLinux 9 or Ubuntu 24.04 in Virtualizor from the client area, or deploy a new VPS in our London location and migrate across. If you want us to sanity check the plan, open a support ticket.
What next
- Choose your target platform and provision it on a Hostworld Linux VPS so you can test your application on PHP 8 and MySQL 8 or MariaDB 10.5.
- Work through more topics in our VPS guides to prepare for deployment and ongoing management.
- If you need hands-on help sequencing backups, package swaps and cutovers on your Hostworld service, open a support ticket.
Common questions
Will my PHP 7.4 application work on AlmaLinux 9 or Ubuntu 24.04?
Not without testing. AlmaLinux 9 provides PHP 8.0 with streams for 8.1 and 8.2, and Ubuntu 24.04 ships PHP 8.3. PHP 8.0 introduces backward-incompatible changes compared with 7.4, and PHP 8.2 deprecates dynamic properties. Expect to update legacy code and plugins.
Do I get MySQL or MariaDB on AlmaLinux 9?
AlmaLinux 9 provides MariaDB 10.5 in the base Application Stream, with newer MariaDB available as an upgrade path. MySQL and MariaDB packages on AlmaLinux 9 conflict and cannot be installed in parallel. Plan a clean dump and restore if you switch engines.
Why do my PHP pages download instead of running after migration?
Apache is likely not connected to PHP-FPM on the new OS. AlmaLinux 9 does not ship mod_php and expects Apache to proxy to PHP-FPM. Check your PHP-FPM pool’s socket path and update Apache to use it. On AlmaLinux 9 the default socket is under /run/php-fpm, and on Ubuntu 24.04 it is under /run/php.
My app cannot log in to MySQL 8.0 on Ubuntu 24.04. What changed?
MySQL 8.0’s default authentication plugin is caching_sha2_password. Older connectors do not support it and will fail. Upgrade the connector or change the user’s authentication method to one the app supports while you plan an update.
Can I keep my old iptables scripts?
No. AlmaLinux 9 and Ubuntu 24.04 use nftables by default. AlmaLinux 9 manages firewall rules with firewalld. Ubuntu 24.04 supports ufw. Translate your rules and test them before applying to avoid locking yourself out.