Skip to content

Upgrading the PHP version: inventory, testing and a fallback plan

Installing a new PHP version takes minutes. Finding out whether the application still does what it should afterwards takes longer — and that work decides whether the switch is a quiet appointment or an outage.

  • Who it is forBusinesses running PHP applications, developers
  • LevelHow-to
  • Reading timeabout 10 minutes
  • Last updated24 October 2026

What you will learn

  • Which PHP versions still receive security fixes in October 2026
  • What an inventory has to cover before the upgrade
  • How tools and tests find outdated code before users do
  • What the switchover and the way back look like, so that an error does not become an outage

In short

Split the upgrade into two steps. First, adapt the code so that it runs on the old and the new PHP version, and deploy it in that form. Only then switch the runtime. Because the code tolerates both versions, the way back is a matter of switching the version back rather than an emergency repair under time pressure.

Three checks sit in between: an inventory of the environment (extensions, libraries, configuration, background processes), a static analysis of the code against the target version, and a test run on an environment that matches production. The target version follows from the PHP project’s support list and from whether your dependencies are ready.

Which versions are supported in October 2026

The PHP project maintains each release branch for four years: two years of full support, during which reported bugs and security issues are fixed in regular point releases, followed by two years of fixes for critical security issues only, released as needed. After that, support ends. The status according to php.net on 24 October 2026:

Support periods according to php.net (“Supported Versions” and “Unsupported Branches”), retrieved 24 October 2026
VersionReleasedActive support untilSecurity fixes until
PHP 8.520 November 202531 December 202731 December 2029
PHP 8.421 November 202431 December 202631 December 2028
PHP 8.323 November 202331 December 2025 (ended)31 December 2027
PHP 8.28 December 202231 December 2024 (ended)31 December 2026
PHP 8.1 and older—endedended (PHP 8.1 on 31 December 2025)

Two dates fall within the next few weeks: on 31 December 2026, security support for PHP 8.2 ends, and on the same day PHP 8.4 moves into the phase in which only security issues are fixed. An application on PHP 8.2 or older should therefore be scheduled now, not in January.

A sensible target is the newest version that all your dependencies officially support — in October 2026 usually PHP 8.4 or 8.5. If the libraries are not ready for 8.5 yet, 8.4, with security fixes until the end of 2028, is a sound intermediate target. Some Linux distributions and hosting providers maintain their own PHP packages for longer. That is a commitment from that provider, not from the PHP project, and it should be in writing.

Inventory: what the new version can affect

A PHP upgrade does not only concern the source code. Many surprises come from the environment. A careful inventory looks at five things:

  • PHP extensions. Which are loaded (php -m), and do they still exist for the target version? With PHP 8.4, for example, IMAP, OCI8, PDO_OCI and PSpell were removed from the standard distribution and moved to PECL. If your application fetches e-mail via IMAP, that needs solving before the switch.
  • Libraries. Every dependency has to allow the target version. composer why-not php 8.4 shows which installed packages prevent it. How to update them in a controlled way afterwards is covered in the article on dependencies.
  • Changed and deprecated language features. For every version step, php.net publishes a migration guide listing backward-incompatible changes and deprecated features. Moving from 8.2 to 8.5 means reading three of them — one per step.
  • Configuration. The php.ini of a freshly installed version often starts with default values. Memory limit, upload sizes, time zone, session and OPcache settings have to be carried over deliberately.
  • Background processes. Cron jobs, queue workers and command-line scripts often run on a different PHP installation from the website. An upgrade that only switches the web server leaves them behind on the old version.

The result is a list of findings and decisions, not a guess. How such a review begins for an application you are taking over is described in Taking over existing PHP software.

Finding outdated code before users do

Three kinds of tools help to fill the list from the code itself. None of them replaces a test run, but each finds places that a test only hits by chance.

  • PHPCompatibility is a rule set for PHP_CodeSniffer that checks code against a target version, for example with --runtime-set testVersion 8.4-. It finds removed functions and changed syntax, including in code that rarely runs. Checks against PHP 8 need version 10, which in October 2026 is only available as a pre-release (10.0.0-alpha2); the last stable release, 9.3.5, dates from 2019 and predates PHP 8.
  • PHPStan analyses code without executing it. The phpVersion parameter sets the PHP version to check against; since PHPStan 2.0 it can also be a range from a minimum to a maximum version — useful for the transition period in which both versions have to work.
  • Rector rewrites code automatically, for example turning outdated parameter declarations into the new form. vendor/bin/rector process --dry-run shows the changes without applying them. Automated changes belong in a code review like any other.

What static tools miss, PHP reports itself at runtime, as a notice of level E_DEPRECATED. Many production configurations do not log these notices. During testing, they should therefore be collected explicitly. An example with two typical leftovers:

PHPlegacy.php · runs on PHP 8.3 without a notice
<?php
// Old code that still runs, but newer PHP versions complain about it.
function formatInvoice(DateTimeInterface $date = null): string
{
    return ($date ?? new DateTimeImmutable('2026-10-24'))->format('d.m.Y');
}

function isPaid(mixed $value): bool
{
    return (boolean) $value;
}
Two places that went unnoticed for years: a parameter that silently accepts null because its default value is null, and the long form (boolean) of a type cast.
PHPPHP 8.3 to 8.5 · tested with PHP 8.3, 8.4 and 8.5 CLI
<?php
declare(strict_types=1);

// Collect deprecation notices instead of hiding them,
// e.g. while the test suite runs against the new PHP version.
$found = [];
set_error_handler(function (int $no, string $msg, string $file, int $line) use (&$found): bool {
    $found[] = sprintf('%s:%d %s', basename($file), $line, $msg);
    return true; // handled, do not print
}, E_DEPRECATED | E_USER_DEPRECATED);

require __DIR__ . '/legacy.php';
echo formatInvoice(), ' ', var_export(isPaid(1), true), PHP_EOL;

echo 'PHP ', PHP_VERSION, ': ', count($found), ' deprecation(s)', PHP_EOL;
foreach ($found as $entry) {
    echo '  ', $entry, PHP_EOL;
}
Output: PHP 8.3 reports 0 deprecation(s). PHP 8.4 reports the implicitly nullable parameter, and PHP 8.5 additionally reports the non-canonical cast (boolean). The fix — ?DateTimeInterface $date = null and (bool) — runs on all three versions without a notice. That is exactly the version that gets deployed before the switch.

A hypothetical example

The cron job that was left behind

A company runs a customer portal on PHP 8.2. Its hosting provider moves the website to PHP 8.4 as planned, the tests pass, the portal works. Three days later, someone notices that no orders have reached the inventory system since the switch.

The cause: the nightly export runs as a cron job through a hard-coded path to the command-line PHP. That installation was never switched, and a library that came with the last update now requires a newer version. The job aborts, writes its error to a log file nobody reads, and otherwise stays silent.

The inventory would have found this with a single question: which processes start PHP, and with which binary? Add monitoring that checks not only whether the site responds, but whether the export has run since yesterday. How errors in such processes become visible is covered in Error handling and logging.

Testing and a trial run on the target version

Existing automated tests run on the new version first, with deprecation notices switched on. Where tests are missing, start with the processes whose failure someone would notice: login, creating an order, generating an invoice, data export, sending e-mail, file upload. Why a test only proves something when it checks concrete cases is explained in the article on software testing.

Next comes a trial run on a test environment that matches production: the same extensions, the same configuration, the same cron jobs and a recent copy of the data prepared for testing. Interfaces to other systems are tested there against their test accounts, not the live ones. Where several PHP versions are installed side by side, as many server control panels allow, the test environment can be switched per site without touching the rest of the server.

Once the error log stays quiet for a few days and the background processes have each completed at least one full run, the application is ready for the switch.

Switchover and fallback plan

The fallback plan is written before the switch — with names and criteria, not as an intention.

  1. Deploy code for both versions. The changes go live while the old PHP version is still running. In Composer, the config.platform.php setting keeps dependencies at a level both versions can carry.
  2. Choose the moment. Outside peak hours, but with people available — not on the Friday evening before a holiday.
  3. Switch. Web server, command line and workers together, following the list from the inventory.
  4. Observe. The error log, the business-critical processes checked by hand, and the background processes on their first run.
  5. Decide. Criteria agreed in advance state when to switch back, and a named person makes the call.

Because the code runs on both versions, the way back consists of resetting the PHP version, not rolling back code. Only once the new version has run stably for an agreed period is the platform setting raised, and the code may then use features that exist only in the new version. From that moment there is no simple way back, which is why it is a deliberate step.

If you run an application that has grown over the years and cannot judge how far it is from a supported version, that is a typical starting point for PHP modernisation.

Common misconceptions

The home page uses a small part of the code. Exports, cron jobs, rarely used forms and error paths often reveal problems only days later.

They announce that a behaviour may disappear in a later version. Collecting and fixing them now means less work and fewer surprises at the next upgrade.

No. But every migration guide in between should be read, because changes introduced in PHP 8.3 also apply when jumping straight from 8.2 to 8.5.

Further sources

About the author

Fabian Lücker is managing partner of PHP Schmiede KG in Rheine and has worked in software development since 2007. He is responsible for development and design, and writes here about decisions that come up in real projects.

Is your application running on an older PHP version?

Tell us the current version, the environment and the most important processes. We will explain what an inventory for the upgrade involves.