Tech

PHP and Ubuntu Need Your Attention – Upgrade Your Stack ASAP


Recently, PHP and Ubuntu released new versions. Since we – like many others – depend on this stack being secure and up to date, we decided to share our step-by-step maintenance process for this upgrade sprint, in case you want a sanity check for your own.
When running WordPress on an Ubuntu + Nginx + PHP-FPM stack, keeping PHP and Ubuntu up to date isn’t just about performance; it’s about security, stability, and compatibility. We upgraded both PHP and Ubuntu versions on our staging and production servers, as well as on all of our clients’ servers.

Here’s exactly how we did it, so you can follow the same process with minimal risk of downtime and exposure.

PHP-and-UBUNTU-feat

1. Preparation – Backups First

Before any upgrade, we secured our environment with multiple backup layers:

  • EC2 Instance Snapshot – Created a complete AWS EC2 snapshot for full rollback capability.
  • All-in-One WordPress Backup – Ensured a restorable WordPress copy.
  • Nginx Configuration Backup – Saved current configuration files.
  • PHP Package List Backup – Stored the list of installed PHP packages in case we needed to reinstall them later:
dpkg -l | grep php | tee packages.txt

2. Upgrading Ubuntu

We followed the official AWS documentation for upgrading Ubuntu on an EC2 Linux instance:

AWS EC2 Ubuntu LTS Upgrade Guide
This step ensures the latest kernel, system libraries, and security patches are in place.

3. Installing and Starting PHP-FPM 8.1

After upgrading Ubuntu, we moved on to the required PHP version:

apt install php8.1-fpm
systemctl start php8.1-fpm.service

This prepared the server for the updated PHP runtime while keeping it running through the FPM process manager.

4. Updating Nginx Configuration

With PHP 8.1 installed, we needed to point Nginx to the new PHP-FPM socket.
 We edited the relevant virtual host configuration file:

/etc/nginx/sites-available/bluegrid.io

Updated the:

fastcgi_pass

directive:

fastcgi_pass unix:/run/php/php8.1-fpm.sock;

Then, reloaded Nginx to apply the changes.

5. Adjusting Nagios NRPE Settings

During the upgrade, we made small monitoring adjustments:

mv /etc/xinetd.d/nrpe /etc/xinetd.d/nrpe.disabled
systemctl restart nagios-nrpe-server

This ensured our monitoring tools remained operational after the OS and PHP changes.

6. Testing the Site

Once the upgrade was complete, we tested everything before declaring success:

  • Contact Form
    – Submitted test messages.
  • Careers Page
     – Verified application forms worked.
  • Log Monitoring
    – Checked WordPress and PHP logs in real time:
tail -f /var/log/wp-debug.log

Why You Should Upgrade Your PHP & Ubuntu Versions

Running outdated PHP or Ubuntu exposes your server to security vulnerabilities, plugin/theme incompatibility, and performance degradation.

Our approach

Backup → OS upgrade → PHP upgrade → config changes → monitoring adjustments → testing – kept downtime minimal and ensured a smooth transition.

If you’re running a WordPress site on Ubuntu with Nginx and PHP-FPM, we recommend planning your upgrade cycle before an end-of-life deadline forces you to.
Your future self (and your visitors) will thank you.

Ivan Dabić

A man with a beard and glasses, wearing an orange hoodie and a black cap with a Hard Rock Cafe logo, stands with his arms crossed against a plain white background.

Ivan Dabić

Co-founder and CEO of BlueGrid.io, with a background in cloud infrastructure, distributed systems, monitoring, and security operations. He works closely with engineering teams to build and operate reliable systems while documenting both technical and organizational aspects of modern engineering work.

Ivan is a metalhead, and big fan of cyberpunk move genre. If you are his secret Santa go with Star Wars Lego box!

Share this post

Share this link via

Or copy link