This guide covers keeping a running CloudSOE WordPress instance patched and up to date. It covers PHP, the Ubuntu 26.04 LTS operating system and WordPress itself, plus moving to a fresh image when an in-place upgrade isn’t the right call.

It’s especially important right now. PHP2Shell (CVE-2026-109618 and CVE-2026-109619) is a critical remote code execution flaw in PHP that attackers are already exploiting, and it’s one of several recent CVEs in the web stack. If your site is reachable from the internet, patch PHP today.

What you can upgrade in place

ComponentIn place?How
Operating system (Ubuntu 26.04 LTS)Yes, for updates within 26.04apt (see Update the operating system). For a new Ubuntu release, use a fresh image
PHP 8.5 (Ubuntu packages)Yesapt, then restart Apache (see Patch PHP)
WordPress core, plugins and themesYesDashboard → Updates (see Upgrade WordPress)
Apache and MariaDBYes, for updates within 26.04apt, along with the rest of the OS
phpMyAdmin (older instances only)NoRemove it (see phpMyAdmin on older instances)

Before you start: back up

Take both kinds of backup before you patch or upgrade anything.

1. A cloud disk snapshot. This lets you roll the whole instance back in minutes:

  • AWS: open EC2 → Volumes, select the instance’s root volume, then choose Actions → Create snapshot.
  • Azure: open the VM, go to Disks, select the OS disk, then choose Create snapshot.

2. An application-level backup. This is the database plus wp-content:

sudo mysqldump --single-transaction wordpress | gzip > /home/$(whoami)/wordpress-db-$(date +%F).sql.gz
sudo tar czf /home/$(whoami)/wp-content-$(date +%F).tar.gz -C /var/www/wordpress wp-content
sudo cp /var/www/wordpress/wp-config.php /home/$(whoami)/wp-config.php.bak

Copy these files off the instance, for example with scp to your own machine or to S3 or Azure Blob storage.

Patch PHP (PHP2Shell)

PHP2Shell is a pair of vulnerabilities, CVE-2026-109618 and CVE-2026-109619, published on 21 October 2026. They allow critical remote code execution in PHP 5.4 through 8.5 and are being exploited in the wild. Updating PHP is the only complete fix. The published workarounds are incomplete, so don’t rely on them.

Upstream PHP fixed it in 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Ubuntu keeps its own version numbers and backports the fix, so what matters is the package version, not the number php -v prints.

Check your PHP version

php -v
dpkg -l | grep -E '^ii +php[0-9.]+-(cli|common) '

Compare the version column with the patched package:

Base OSPHP packagePatched version (or later)
Ubuntu 26.04 LTSphp8.58.5.4-0ubuntu1.5

php -v still reports PHP 8.5.4 after the patch, because Ubuntu backports the fix without changing the upstream number. Go by the dpkg -l output.

Update PHP

sudo apt update
sudo apt upgrade

This updates PHP along with everything else. The WordPress image runs PHP inside Apache with libapache2-mod-php, so restart Apache to load the patched PHP:

sudo systemctl restart apache2

To confirm which PHP integration Apache uses, run ls /etc/apache2/mods-enabled/ | grep php. You should see php8.5.load. If you’ve switched to PHP-FPM yourself, restart it too: sudo systemctl restart php8.5-fpm.

Confirm the fix

dpkg -l | grep -E '^ii +php[0-9.]+-(cli|common) '

Both php8.5-cli and php8.5-common should show 8.5.4-0ubuntu1.5 or later. If they don’t, run apt policy php8.5-common to check that the resolute-security or resolute-updates repository is reachable.

Update the operating system

The WordPress image runs on Ubuntu 26.04 LTS, and Ubuntu publishes security updates for it through apt:

sudo apt update
sudo apt upgrade

If apt upgrade reports packages as “kept back” (often a new kernel), run sudo apt full-upgrade. Review the list before you confirm.

Then check whether a reboot is needed:

[ -f /var/run/reboot-required ] && cat /var/run/reboot-required.pkgs

If the file exists, reboot when it suits you. Apache and MariaDB start automatically:

sudo reboot

After the reboot, clear out the old kernels with sudo apt autoremove --purge.

Automatic security updates

CloudSOE images don’t change the base OS’s automatic-update settings. To see whether unattended-upgrades is active on your instance:

systemctl status unattended-upgrades
apt-config dump APT::Periodic::Unattended-Upgrade

If the setting shows "1", Ubuntu security updates (including PHP fixes) install automatically. You still need to restart Apache and reboot yourself. To turn it on, run sudo apt install unattended-upgrades && sudo dpkg-reconfigure -plow unattended-upgrades.

New Ubuntu releases

Don’t run do-release-upgrade on a production WordPress instance. A release upgrade replaces PHP, MariaDB and Apache all at once, which makes problems hard to roll back. When you want a newer Ubuntu release, move to a fresh CloudSOE image instead.

phpMyAdmin on older instances

Current CloudSOE WordPress images don’t include phpMyAdmin. On Ubuntu 26.04 it comes only from the universe repository, which doesn’t get standard security support, and one of its dependencies (php-twig) carries a known CVE. Instances launched from earlier images may still have it. Check and remove it:

dpkg -l phpmyadmin 2>/dev/null | grep '^ii' && sudo apt remove --purge phpmyadmin && sudo apt autoremove --purge

Administer the database over SSH instead: sudo mysql wordpress.

Upgrade WordPress

The image installs WordPress from the official wordpress.org release archive into /var/www/wordpress. The files are owned by the web user www-data, and wp-config.php sets FS_METHOD to direct. That means WordPress’s built-in updater works out of the box, with no FTP credentials needed.

Core, plugins and themes

  1. Take the backups described in Before you start.
  2. Log in to https://<your-site>/wp-admin and open Dashboard → Updates.
  3. Update WordPress core first. WordPress puts the site into maintenance mode while the update runs, then takes it out again.
  4. If WordPress asks to update the database, click Update WordPress Database. You can also visit /wp-admin/upgrade.php.
  5. Then update plugins and themes from the same screen.

WordPress applies minor (security) releases automatically by default. Major releases, such as a new 6.x version, are a click on that same screen. Both are supported in-place upgrades.

Fix file ownership

If an update fails with a “could not create directory” or permissions error, it’s usually because files were uploaded over SFTP or edited as another user. Reset the ownership and try again:

sudo chown -R www-data:www-data /var/www/wordpress
sudo chmod -R g+w /var/www/wordpress

The g+w part keeps SFTP uploads working for your admin user, who is in the www-data group.

Prefer the command line?

The WordPress image doesn’t ship wp-cli, but you can add it. These are the same steps the CloudSOE WooCommerce image uses:

sudo curl -fLo /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
sudo chmod 755 /usr/local/bin/wp

sudo -u www-data wp --path=/var/www/wordpress core update
sudo -u www-data wp --path=/var/www/wordpress core update-db
sudo -u www-data wp --path=/var/www/wordpress plugin update --all
sudo -u www-data wp --path=/var/www/wordpress theme update --all

Check the installed version at any time:

grep "wp_version =" /var/www/wordpress/wp-includes/version.php

Plugin and theme notes

  • Before a major WordPress release, check that your important plugins and theme support it. A plugin that hasn’t been updated in years is a security risk in its own right.
  • Delete plugins and themes you don’t use rather than just deactivating them. Inactive code can still be exploited.
  • If an update breaks the site, deactivate the offending plugin by renaming its folder, e.g. sudo mv /var/www/wordpress/wp-content/plugins/<plugin> /var/www/wordpress/wp-content/plugins/<plugin>.off. You can also restore from your backup.

Move to a fresh CloudSOE image

Launching a new instance from the latest CloudSOE WordPress image and moving your site across is the cleanest option when:

  • your instance’s Ubuntu release is approaching end of life, or you want a newer release,
  • you want the latest PHP, MariaDB and Apache without a risky release upgrade,
  • the instance has drifted a long way from a clean state, or you suspect it was compromised before you patched. In that case, restore content you trust, not code, and review users and plugins.

1. Back up the old instance

On the old instance:

mkdir -p ~/migration
sudo mysqldump --single-transaction wordpress | gzip > ~/migration/wordpress-db.sql.gz
sudo tar czf ~/migration/wp-content.tar.gz -C /var/www/wordpress wp-content
sudo cp /var/www/wordpress/wp-config.php ~/migration/wp-config.php.old
sudo chown -R $(whoami) ~/migration

2. Launch the new instance

Launch the latest CloudSOE WordPress image, following the AWS or Azure getting-started guide. Let first boot finish (systemctl status wordpress-firstboot), but don’t run the WordPress web installer. Your restored database replaces it.

3. Copy the backup across

From your own machine, use ubuntu on AWS or your chosen admin user on Azure:

scp -r ubuntu@<old-ip>:migration ./migration
scp -r ./migration ubuntu@<new-ip>:

4. Restore on the new instance

On the new instance:

# Database: replace the empty database created at first boot
sudo mysql -e "DROP DATABASE wordpress; CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
gunzip -c ~/migration/wordpress-db.sql.gz | sudo mysql wordpress

# Files: themes, plugins and uploads
sudo tar xzf ~/migration/wp-content.tar.gz -C /var/www/wordpress
sudo chown -R www-data:www-data /var/www/wordpress
sudo chmod -R g+w /var/www/wordpress

The wordpress database user and its privileges survive the drop and re-create, so nothing else needs to change.

Keep the new instance’s wp-config.php. It holds the new instance’s unique database password and fresh salts, and it matches the credentials in /opt/wordpress/default-wordpress-credentials.txt. Logged-in users will need to log in again. Compare it with wp-config.php.old and copy across only settings you added yourself. If your old site used a table prefix other than wp_, set $table_prefix to match.

Your old WordPress admin accounts and passwords come across with the database.

5. Fix the site address

If you’re moving a domain to the new instance, the URL stays the same once DNS is switched (next step). If you’re testing on the new IP first, or your site uses an IP address, update the site URL:

sudo mysql wordpress -e "UPDATE wp_options SET option_value='https://<new-ip-or-domain>' WHERE option_name IN ('siteurl','home');"

6. Switch traffic and retire the old instance

  1. Point your DNS A record at the new instance’s IP. You can also move the address itself: on AWS, re-associate your Elastic IP with the new instance; on Azure, dissociate the static public IP from the old VM’s network interface and associate it with the new one.
  2. Once DNS points at the new instance, request a new trusted certificate there with sudo certbot --apache -d example.com. See the configuration guide.
  3. Stop (don’t delete) the old instance and keep it for a few days in case you need something from it.
  4. When you’re happy, terminate or delete the old instance, its disks and the snapshots you took for this upgrade.

Check everything works

After any patch, upgrade or migration:

# Services are running
systemctl status apache2 mariadb --no-pager

# PHP is the patched package
dpkg -l | grep -E '^ii +php[0-9.]+-(cli|common) '

# WordPress version
grep "wp_version =" /var/www/wordpress/wp-includes/version.php

From your own machine, since an Azure VM often can’t reach its own public IP:

curl -skI https://<public-ip>/

Then, in WordPress, open Tools → Site Health. It flags outdated PHP, failed background updates, inactive plugins and other common problems. Finally, click through your home page, a few posts and any contact or checkout forms.

Next steps