+420 737 981 440

Upgrading PHP 7 to 8.4/8.5: a practical guide for business applications

An application on PHP 7.4 or 8.0 no longer receives security fixes, and the longer you put off the upgrade, the more it costs. Moving to PHP 8.4 or 8.5 can be done gradually and without downtime: an audit, tests, automated changes with Rector, static analysis, updating libraries and the framework, and deployment in small steps.

Why deal with a PHP upgrade now

PHP 7.4 and PHP 8.0 have been unsupported for several years, and security fixes have ended for PHP 8.1 as well. If your business application runs on one of these versions, every newly discovered bug in PHP itself stays in it for good. The current versions are PHP 8.4 (released in November 2024) and PHP 8.5 (November 2025).

It is not only about security. Old PHP brings other, less visible costs:

  • Hosting – providers are gradually switching old versions off or charging extra to run them.
  • Libraries – new versions of Composer packages require newer PHP, so you cannot even install fixes for vulnerabilities in your dependencies.
  • People – developers who know modern PHP avoid old code or charge more for working on it.
  • Performance – PHP 8 is usually faster for typical web applications, often without a single change to the code.

On top of that, the upgrade gets more expensive over time. Jumping from 7.4 to 8.4 means working through the changes of five versions at once. If you update continuously, you only ever deal with one.

What breaks when moving from PHP 7.4 to 8.x

An explanation for owners and product managers

PHP 8 is stricter. Older versions often turned a blind eye – when code passed a nonsensical value to a function, PHP wrote a warning to the log and carried on. In many such situations the new versions stop the application with an error. Code that “somehow worked” for years can therefore stop working after the upgrade in places nobody expects – typically in exports, imports, cron jobs or rarely used parts of the administration.

The second group consists of functions that PHP removed entirely after years of warnings. If the application uses them, it will not run on the new PHP at all until the code is changed.

Concrete examples for developers

  • Removed functions (PHP 8.0): each(), create_function(), money_format(), get_magic_quotes_gpc(). In applications dating from the PHP 5 era, also mysql_*, which was already removed in PHP 7.0.
  • Comparing a string with a number: 0 == "abc" returns false in PHP 8, previously true. A silent change in behaviour that no error message will reveal.
  • Exceptions instead of warnings: many internal functions throw a TypeError or ValueError when given an argument of the wrong type, for example count() on a value that is neither an array nor Countable.
  • Nested ternary operator without parentheses ($a ? $b : $c ? $d : $e) is a fatal error since PHP 8.0.
  • Curly braces for character access ($str{0}) are no longer supported.
  • An undefined variable or array key raises a warning instead of a notice – the logs fill up quickly.
  • null in internal functions (PHP 8.1): strlen(null), trim(null) and the like are deprecated. In old code this often means hundreds of places.
  • Dynamic properties (PHP 8.2): assigning to an undeclared object property is deprecated.
  • Implicitly nullable parameters (PHP 8.4): writing function f(Foo $x = null) is deprecated; the correct form is ?Foo $x = null.

Deprecated does not mean broken – the code still runs for now. But it is a list of things that will stop working in one of the upcoming versions, and it makes sense to fix them now, while the code is open anyway.

The upgrade process step by step

I always carry out an upgrade so that the application keeps running throughout and every step can be rolled back on its own. The order that has proven itself looks like this.

1. Audit and inventory

First you need to know exactly what is running in production: the PHP version and extensions, the framework, the libraries in composer.json, cron jobs and integrations with other systems. Running composer audit shows packages with known vulnerabilities. The result is a list of obstacles and an effort estimate – only with these in hand does it make sense to decide on the upgrade.

2. Code in git and a test environment

If the code is not under version control, that is the first task. You also need a local and a test environment where the new PHP runs alongside the old one, with a copy of the database (ideally anonymised).

3. Tests for critical areas

Full test coverage is neither necessary nor realistic. It is enough to automatically verify what the business earns money on: orders, payments, invoices, login, the main exports. In PHPUnit or Nette Tester, or as simple tests that go through the key pages and check that they do not return an error.

4. Static analysis

PHPStan finds a large share of problems without running the code – calls to non-existent functions, wrong types, typos in names. With old code I start at a low level and store the existing errors in a baseline so that only new ones are flagged.

5. Automated changes with Rector

Rector can make a large part of the mechanical changes by itself: rewriting removed constructs, adding parentheses, adjusting nullable parameters and so on. I run it gradually, one PHP version at a time, and review and commit each batch of changes separately. Rector saves dozens of hours of manual work, but it does not replace review – it will not resolve changes in behaviour (such as comparing strings with numbers) for you.

6. Updating dependencies

Composer libraries are updated to versions that support the target PHP. Abandoned packages have to be replaced or taken over into your own code. This is where an upgrade often gets stuck the longest.

7. Upgrading the framework

Both Nette and Symfony are upgraded gradually, version by version. With Symfony it pays to go via the LTS versions and, before each jump, remove all the deprecation notices the framework reports in the previous version. For older applications on Nette 2.x, moving to Nette 3 is a bigger intervention – the Latte templating system and the handling of forms and configuration change, for example – and it is best planned as a separate phase.

8. Staging and deployment in small steps

Before production, the application runs on a test server with the same configuration as production. Ideally the automated checks (tests, PHPStan) run in CI, for example in GitLab CI, on every change. Switching the PHP version in production is then a boring operation with a prepared way back. For the first few days after deployment I watch the error log closely.

How long an upgrade takes and what affects the price

There is no universal figure. For a small, maintained application with an up-to-date framework it is a matter of days; for a large system without tests or a framework, weeks to months. The price is affected most by:

  • the starting version – a jump from PHP 5 is an order of magnitude harder than from 7.4,
  • the framework – a custom solution without a framework means more manual work, while an old framework needs its own upgrade,
  • dependencies – how many libraries are abandoned or do not support the new PHP,
  • tests and environments – without git, a test server and tests, these have to be created first,
  • code quality – duplication and logic scattered across templates increase the number of places to fix,
  • integrations – payment gateways, carrier APIs and accounting that have to be verified.

That is why I never estimate an upgrade blind. A reliable estimate only comes from an audit that goes through these factors in the actual code.

PHP 8.4, or straight to 8.5?

In general I recommend targeting the newest version supported by all your key libraries and your hosting. Each version has roughly two years of active support and another two years of security fixes, so a newer version means a longer period of peace. If an important dependency does not yet support PHP 8.5, PHP 8.4 is a perfectly reasonable target – when upgrading from PHP 7, the difference between them is small compared with what has to be done either way.

PHP upgrade checklist

  • PHP version, extensions and configuration in production identified
  • Code in git, matching what actually runs in production
  • Local and test environments with the target PHP version
  • Working backups of code and database, verified by a restore
  • List of dependencies and the output of composer audit
  • Tests of critical processes (order, payment, invoice, login)
  • PHPStan with the target PHP version set and a baseline
  • Rector run version by version, changes reviewed
  • Libraries updated or replaced
  • Framework on a supported version, with no deprecation notices
  • Cron jobs, imports, exports and integrations with external systems checked
  • Deployment plan with a quick way back and log monitoring after deployment

Where to start

The cheapest first step is to find out what state the application is in. In a PHP application audit I go through the code, dependencies and deployment and write up a concrete path to PHP 8.4 or 8.5 – what will break, what Rector will convert and in what order to proceed. A quick audit typically takes 4–8 h, i.e. 10,000–20,000 CZK excl. VAT.

If nobody has been looking after the application since the original developer left, we can combine the upgrade with taking over and stabilising it.

← All articles

More services

Automation and data processing

Price lists, enquiries, invoices and catalogues processed automatically and connected to your system. No more manual retyping. More about automation

PHP project takeover

Has your developer or agency left? I take over applications in Nette, Symfony or legacy PHP, stabilise them and keep developing them. How a takeover works

PHP application audit

Code, security, performance, database and the path to PHP 8.4/8.5. A written report with priorities and effort estimates. What the audit covers

Custom application development

B2B systems, admin panels, booking, invoicing and configurators in Nette, Symfony and React, integrated with your existing systems. How custom development works

Working on a similar project?

Write me a few sentences about your application. I will reply within one working day and suggest how to get started.