ix
ix

informatix

PL version Book a discovery call
Home / Blog / PHP Migration & Upgrade Guide — 5.6/7.x to 8.x Action Plan [...
• Updated: • 15 min read •

PHP Migration & Upgrade Guide — 5.6/7.x to 8.x Action Plan [2026]

A PHP migration to 8.x removes security risks and speeds the application up without touching business code. The step-by-step path — from compatibility audit and tests, through Rector, to monitored deployment. With a support-date table, costs and a checklist.

PHP Migration & Upgrade Guide — 5.6/7.x to 8.x Action Plan [2026]
DevOps & maintenance

Migrating PHP from an old version to a current one (8.4/8.5) is one of the most profitable modernizations in an old system — it removes a whole class of security risks, speeds the application up without touching business code, and unblocks framework and library upgrades. PHP 5.6 has been without security support since the end of 2018, PHP 7.4 since November 2022, and PHP 8.1 since the end of 2025 — systems running on these versions are today without patches for known vulnerabilities. This guide shows how to plan the migration step by step, what breaks, how long it takes and what it costs.

Key takeaway: A PHP migration is a process, not a version swap on the server. The order: compatibility audit (PHPCompatibility, PHPStan) → safety-net tests → automated refactoring (Rector) → staging → production with monitoring. A safe migration through an intermediate version (e.g. 7.4) is faster than jumping two generations at once, though simple projects can go directly.

Why an old PHP version is a problem

Three costs that grow every year.

Security. PHP versions past end of support receive no security fixes. This is not a theoretical risk — known vulnerabilities in the interpreter and standard libraries get publicly documented, and a running system becomes a target. In systems handling payments or personal data, this is a compliance risk, not just a technical one.

Ecosystem compatibility. New versions of libraries and frameworks require new PHP versions. Staying on 5.6 or 7.x cuts you off from updates — and with them from security and performance fixes. Increasingly, hosting providers are retiring old versions too — you end up paying for "legacy add-ons" or hunting for special setups.

Performance and maintenance costs. PHP 8.x is significantly faster than PHP 5.6 — the engine optimizations and JIT alone can speed an application up by tens of percent with no code changes. On top of that comes the cost of people: developers who know PHP 5.6 are increasingly rare, and rates keep rising. The broader picture of these costs is covered in the article on technical debt.

PHP versions and support dates — what is still safe

Since 2024 the PHP release cycle gives every branch four years of support: two years of bug fixes and two years of security fixes. After that the branch reaches end of life (EOL) and receives no updates at all — not even critical ones.

Version Released Security support until Status today
PHP 8.5 20 Nov 2025 31 Dec 2029 full support
PHP 8.4 21 Nov 2024 31 Dec 2028 full support
PHP 8.3 23 Nov 2023 31 Dec 2027 security fixes only
PHP 8.2 08 Dec 2022 31 Dec 2026 security fixes only — ending soon
PHP 8.1 25 Nov 2021 31 Dec 2025 end of life
PHP 8.0 26 Nov 2020 26 Nov 2023 end of life
PHP 7.4 28 Nov 2019 28 Nov 2022 end of life
PHP 7.3 and older 2018 and earlier 2021 and earlier end of life

Warning: PHP 8.2 reaches end of security support on 31 December 2026. If your system runs on 8.2, this is the last window to plan an upgrade — after that date any new interpreter vulnerability stays unpatched. The details and an action plan are in the article on the PHP 8.2 end of life.

The full schedule with release and support dates for every version — and which version is safe for which type of project — is collected in a separate article on PHP versions and support dates.

What is new in PHP 8 — what you gain from migrating

A migration is not only "security patches". PHP 8.x also brings features that change how code is written — and arguments that convince the team.

  • JIT (since 8.0) — compiling parts of the code to machine code at runtime. The biggest gain where CPU matters (computation, data processing), smaller in I/O-bound applications.
  • Attributes (since 8.0) — native metadata for classes and methods (#[Route], #[Test]) instead of PHPDoc annotations. Frameworks (Symfony, Laravel, Doctrine) moved their configuration onto them.
  • Named arguments (since 8.0) — function(limit: 10, offset: 0) — clearer and immune to parameter reordering.
  • Constructor property promotion (since 8.0) — public function __construct(private Logger $logger) instead of manual field assignment.
  • Match expression (since 8.0) — the successor to switch, with strict comparison and a return value.
  • Enums (since 8.1) — the enum Status: string types that were missing for years.
  • Readonly properties (since 8.1) — immutable object fields without getters.
  • Fibers (since 8.1) — the foundation for concurrency in libraries (Amphp, ReactPHP).
  • true/false/null types and typed class constants (since 8.2/8.3) — a more precise type system.
  • Property hooks and asymmetric visibility (since 8.4) — getters/setters directly on properties.

None of these alone is a reason to migrate, but together they change what new code looks like in the project — and old constructs gradually lose tooling support (PHPStan, Rector, IDEs).

What the migration path looks like

The safest path from PHP 5.6 goes through an intermediate version — 7.4 or 8.0 — and only then to 8.3+. Jumping two generations at once is possible, but it usually means more errors at the same time and harder diagnosis. The intermediate version gives you checkpoints: tests, deployment and observation after every step.

Starting point Recommended path Typical time for a small project
PHP 5.6 5.6 → 7.4 → 8.0 → 8.4 2–4 weeks
PHP 7.0–7.3 7.x → 7.4 → 8.4 1–3 weeks
PHP 7.4 7.4 → 8.0 → 8.4 (or straight to 8.4) 1–2 weeks
PHP 8.0/8.1 straight to 8.4 days–2 weeks
PHP 8.2/8.3 straight to 8.4/8.5 days

The exact spread of changes between versions — what stops working on 7.4 → 8.0, 8.0 → 8.1, 8.1 → 8.2 and beyond — is covered in the article on the PHP 7.4 to 8.x migration.

For Laravel applications there is an additional dimension — migrating the framework between versions, with its own sequence and pitfalls. That is a separate journey that can run in parallel, but then the plan must be all the more careful.

Step 1 — compatibility audit

Before changing anything, measure the scale of the problem. Version-compatibility tools show exactly which code fragments will stop working:

  • PHPCompatibility — a PHP_CodeSniffer ruleset that scans code for constructs removed or changed in newer versions,
  • PHPStan with rules for the target version — catches type and call problems that become errors in the new version,
  • extension inventory — whether the system uses extensions that disappeared or changed APIs (e.g. mysql_* removed in PHP 7),
  • dependencies — checking which libraries have versions compatible with the target PHP and which are abandoned.

The audit runs with a few commands — it is the cheapest stage of the whole migration

# 1. Compatibility scan against the target version (PHPCompatibility)
composer require --dev phpcompatibility/php-compatibility
vendor/bin/phpcs -p . --standard=PHPCompatibility \
  --runtime-set testVersion 8.4-

# 2. Static analysis for the target version (PHPStan)
composer require --dev phpstan/phpstan
vendor/bin/phpstan analyse src --level=5

# 3. Dependency review — which packages support PHP 8.x
composer why-not php 8.4

The audit output is a list of blockers split into categories: "auto-fixable," "needs a human decision," "library must be replaced." That is also the migration plan. More on this stage in the legacy code audit guide.

Step 2 — safety-net tests

A PHP version migration changes system behavior in places nobody expects — from type handling, through sorting, to number formatting. Without tests, every such effect shows up in production.

The minimum is characterization tests on critical paths: login, checkout, payment, document generation. Running them in CI on the target PHP version turns migration from a gamble into a process with clear criteria — green tests are the deployment condition. If the project has no tests at all, do not start with full coverage: 15–20 end-to-end tests on the most important paths catch most of the regressions a PHP version change reveals.

Step 3 — automated refactoring with Rector

Fixing code by hand for a new PHP version takes weeks. Rector does it automatically: it ships ready-made rulesets for version transitions (PHP 5.6 → 7.x → 8.x) that replace removed functions, update syntax and modernize constructs to current standards.

A minimal configuration for a jump to PHP 8.4 looks like this

<?php
// rector.php
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
    ->withPhpSets(php84: true); // cumulative: 5.6 → 7.x → 8.0–8.4

The rollout practice: run Rector with the ruleset for the nearest step, review the diff (it can be thousands of changes — that is why you need tests), run the tests, commit. Do it version by version rather than all at once — it is easier to attribute any errors to a specific change. The full workshop — rulesets, dry-run mode, pitfalls — is in the article on the Rector PHP upgrade guide.

Rector will not fix everything — logic relying on behaviors that changed between versions (e.g. type casting, sorting functions) needs human decisions. But it eliminates 80–90% of the mechanical work. The refactoring techniques worth combining with the migration are covered in the legacy code refactoring guide.

Step 4 — staging and deployment

You deploy the migration like any other change in the modernization process: staging with real data (on a copy) first, then production with monitoring.

  • staging should run the target PHP version with the same extensions as production — configuration differences are the most common source of "it works on my machine,"
  • schedule the production rollout outside peak traffic and have a rollback plan — the old PHP version stays on the server until stability is confirmed,
  • after deployment, watch error logs and performance for a few days; deprecation warnings in logs are your to-do list for the next iterations,
  • only after stabilization, upgrade dependencies and the framework to target versions — the second stage of the same journey.

The simplest way to keep staging and production identical is containerization. A docker-compose.yml fragment with the PHP version as a variable:

services:
  app:
    build:
      context: .
      args:
        PHP_VERSION: "8.4"   # staging and production — the same value
    volumes:
      - .:/var/www/html
  db:
    image: mysql:8.0

Automated tests and deployments at every stage are not a luxury but a condition of a safe migration — the configuration is covered in the article on CI/CD and DevOps for Laravel.

What usually breaks during migration

Experience from projects says problems cluster in a few places

  • functions removed between versions — each(), create_function(), the mysql_* extension, the old preg_replace /e modifier,
  • types and casting — newer versions are stricter; code that "passed" now throws type errors,
  • null and empty values — passing null to functions expecting strings is deprecated in 8.1 and an error in future versions,
  • dynamic properties — creating properties on the fly is deprecated since 8.2; code relying on it needs refactoring,
  • abandoned libraries — a dependency with no PHP 8-compatible release must be replaced (usually the most time-consuming item),
  • edge behaviors — sorting, numeric string comparison, formatting — where language semantics changes only show up in tests.

Every version adds its own share of changes — the table below lists the most important ones from the point of view of a typical project.

Transition Key changes
7.4 → 8.0 exceptions instead of warnings in many functions, stricter string comparisons, removed each() and create_function(), preg_* changes
8.0 → 8.1 null to non-nullable parameters deprecated, readonly, enums, fibers
8.1 → 8.2 dynamic properties deprecated, part of string interpolation deprecated, readonly classes
8.2 → 8.3 typed class constants, get_class() without argument deprecated
8.3 → 8.4 implicit nullable parameter defaults deprecated, property hooks

None of these is a blocker — each is a line in the plan. Only the ones you do not know about are dangerous, which is why the compatibility audit and tests are not optional. Check the changes in your version in the official php.net migration guide or the PHP.Watch overview.

How long it takes and what it costs

The scale depends on three variables: the number of blockers from the audit, the quality of the tests and the number of abandoned libraries. Indicative ranges for typical projects:

Project Scope Time Cost
Small up to ~20k lines, no exotic dependencies 3–10 days 3,000–10,000 PLN
Medium framework, integrations, a few abandoned libraries 2–8 weeks 10,000–40,000 PLN
Large / legacy no tests, custom extensions, library replacements 2–6 months 40,000 PLN+ (staged)

The biggest variable cost is replacing abandoned libraries — one dependency without PHP 8 support can swallow a week of work if you have to replace it with a custom implementation or find a successor. The second factor is the state of the tests — a project with no tests requires writing them before the migration, which can be half of the entire budget. The full cost breakdown — with stages, TCO and team-size impact — is in the article on the PHP migration cost.

A PHP migration is best planned as part of a wider modernization program — then the costs spread across stages, and each stage delivers value: security, performance, newer libraries. The full plan — from audit to CI/CD — is in Legacy Code Modernization — Step by Step, and the scope of the service on the code maintenance and modernization page.

Before you start, walk through an ordered checklist — from dependency inventory to the rollback plan. The 30 points are collected in the article with the PHP migration checklist.

Frequently asked questions

Can I upgrade PHP without code changes?

In simple projects an upgrade plus tests is sometimes enough, but that is the exception. Code written for PHP 5.6 or 7.x usually uses constructs removed or changed in newer versions. The standard path is a compatibility audit, refactoring with Rector and tests — then deployment. On WordPress sites, updating plugins and the theme is often enough, but custom modifications still need fixes — covered in the article on WordPress and PHP 8.

Does a PHP migration require system downtime?

No. You prepare the migration on staging and deploy like any other change — outside peak hours, with a rollback option. The system does not need to be stopped for the migration; all the work happens outside production, and production only sees the version swap. The old PHP version stays on the server until you confirm stability.

Which PHP version should I target if the system runs on 5.6?

The safe route goes through an intermediate version — usually 7.4 — then 8.0/8.1 and finally 8.4 or newer. Intermediate versions give you checkpoints: tests and deployment after every step. A direct jump is possible in simple projects but makes error diagnosis harder — from 5.6 the language changed across three generations.

Which PHP version should I migrate to in 2026?

Target PHP 8.4 or 8.5 — the versions with full support. PHP 8.3 already receives security fixes only (until the end of 2027), and PHP 8.2 reaches end of life on 31 December 2026. If you are migrating from 5.6/7.x, do not stop at 8.0/8.1 — those are past EOL. The full date table is in the article on PHP versions and support dates.

Will upgrading PHP speed up the application?

Usually yes, and without code changes — newer PHP versions are significantly faster (engine optimizations, JIT since 8.0). The real gain depends on the application profile, but speedups of tens of percent are not uncommon. The full performance effect also requires upgrading dependencies and the framework — the interpreter is one part of the picture.

How long does a PHP migration take?

A small project (a dozen thousand lines, no exotic dependencies) migrates in a few days. A medium system with a framework and extensive integrations typically takes 2–8 weeks, depending on the number of blockers and test quality. Large systems without tests and with abandoned libraries are migrated in stages over several months.

How much does a PHP migration cost?

Typical ranges are 3,000–10,000 PLN (small project), 10,000–40,000 PLN (medium system) and from 40,000 PLN upward for large legacy systems billed in stages. The biggest variables are replacing abandoned libraries and writing tests before the migration. The cost breakdown by stage is in the article on the PHP migration cost.

What is Rector and can it replace a developer?

Rector is an automated PHP refactoring tool — it ships ready-made rulesets for version transitions and can mechanize 80–90% of the changes you would otherwise make by hand. It will not replace a developer — it cannot fix logic relying on changed language behavior or replace an abandoned library. But it shortens the mechanical part of a migration from weeks to days.

How do I check whether my code is compatible with PHP 8?

  • With three tools: PHPCompatibility (scans for removed and changed constructs), PHPStan (type and call problems that become errors in the new version) and a dependency review with composer why-not php 8.4. The result is a blocker list split into automatic, manual and library-replacement items — a ready migration plan.

Do I need to upgrade libraries and the framework after the PHP migration?

Usually yes, but in second order. First you migrate the interpreter and adjust the code, then upgrade dependencies and the framework to target versions. Some libraries require the newer PHP, so their upgrade only becomes possible after the migration — it is the second phase of the same work, not a separate project.


See it in practice: PHP application modernization case study — a business-critical PHP 5.6 system modernized to PHP 8.4 with Rector, PHPUnit regression tests, GitHub Actions CI/CD and monitoring: zero critical incidents in 12 months, deployments from 2 weeks to 2 days.

Sources and tools

KS

Krzysztof Słonina

Full stack developer and owner of Inoventis Solutions (informatix). Since 2009 he has built Laravel/PHP web applications, e-commerce integrations and process automations — including OneCRMApp and FamilyTimelineApp, both running on Laravel, React and Inertia.js.

About the author
Free PDF

Web app requirements checklist

12 control questions to answer before talking to a vendor — faster estimates, fewer hidden costs.

Related posts

23.10.2026

PHP Migration Checklist — 30 Points Before Deployment [2026]

30 items across five phases — from dependency inventory to post-deployment monitoring — with an acceptance criterion per phase and a list of the mistakes such a check eliminates. A migration plan template and a contractor inspection tool.

Read more