Skip to main content
GrN.dk

Main navigation

  • Articles
  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

Upgrading PHP 5: Use PHP 7 as a Bridge, Not the Destination

By Greg Nowak. Updated 23 July 2026.

If a business-critical website still runs PHP 5, changing the server version is the easy part. The real work is uncovering everything that depends on the old runtime: abandoned libraries, custom plugins, scheduled jobs, payment integrations, email delivery and code paths nobody has tested recently.

That is why an old request to ā€œupgrade PHP 5 to PHP 7ā€ needs reframing. Every PHP 7 branch is now unsupported; PHP 7.4 reached end of life in November 2022. As of July 2026, the supported branches are PHP 8.2 through 8.5, with 8.2 already limited to critical security fixes until the end of 2026. For most projects, PHP 8.4 or 8.5 should be the shortlist—but the correct target is the newest supported release that the application, hosting platform and required extensions can all run reliably.

First decide whether the system is worth migrating

Before estimating code changes, establish what the application does for the business. A lightly customised brochure site may be cheaper to rebuild on a maintained platform. A bespoke ordering, membership or operational system may justify a staged migration because its business rules are difficult to reproduce safely.

Record the current PHP version, web server, operating system, database, enabled extensions, CMS or framework version, Composer packages, custom modules, cron jobs, queues and external integrations. Include the people who know the operational exceptions. The undocumented monthly export or unusual refund process is often more important than the homepage.

On a controlled copy of the environment, these commands provide a useful starting point:

php -v
php --ini
php -m
composer validate
composer outdated --direct
composer prohibits php 8.4
composer audit
composer check-platform-reqs

Substitute the intended target for 8.4. Run check-platform-reqs under the target runtime because it checks the real PHP version and installed extensions, not just Composer’s configured platform. Do not run an unplanned composer update on production: dependency upgrades can introduce a second set of changes while you are still diagnosing the runtime migration.

Starting position Sensible route What to approve first
Maintained CMS with little custom code Update the CMS and extensions on staging, then test directly on supported PHP 8 Compatibility check and acceptance test
Custom PHP 5 application Inventory dependencies, scan the code, use isolated PHP 7.4 testing if it helps separate failures, then move to PHP 8 Technical audit and phased estimate
Revenue-critical system with weak test coverage Add smoke tests, monitoring and rollback preparation before changing dependencies or runtime Risk-reduction milestone
Small system with obsolete architecture Compare migration cost with replacement and data export Migration-versus-rebuild decision
A migration decision matrix for choosing the route before anyone changes production.

When PHP 7 is a useful bridge

PHP 7 can still be useful as a diagnostic checkpoint for a large custom application. Moving an isolated staging copy from PHP 5.6 to PHP 7.4 can expose one generation of removed functions and changed error behaviour before PHP 8 adds stricter typing and further incompatibilities.

But this is an engineering tactic, not a deployment destination. Keep the PHP 7 environment private, temporary and disconnected from live customer traffic. If a maintained CMS and its plugins already support PHP 8, going directly to the chosen PHP 8 release is usually simpler. An intermediate step should reduce uncertainty; it should not become another legacy platform to maintain.

Use scanners to find work—not to declare success

PHPCompatibility for PHP_CodeSniffer can identify many version-sensitive constructs. If it is installed in the project, a targeted scan might be:

vendor/bin/phpcs -ps . \
  --standard=PHPCompatibility \
  --runtime-set testVersion 7.4-8.4

Set the range to the runtimes you genuinely intend to test. The tool’s own documentation notes that coverage is not complete, so a clean report is not proof that the application works.

Common findings include removed mysql_* calls, obsolete ereg usage, mcrypt-era encryption, incompatible method signatures and code that depends on PHP 5’s loose comparisons or error handling. Treat encryption and authentication changes as design reviews, not search-and-replace jobs. Group changes into reviewable batches: dependencies, removed APIs, fatal runtime errors, behavioural differences and finally warnings or cleanup.

Test business journeys, not just pages

A homepage loading successfully proves very little. Build a compact acceptance checklist around what customers and staff actually do:

  • sign in, reset passwords and manage sessions;
  • submit forms, receive email and process file uploads;
  • search, place orders, pay, refund and generate invoices where applicable;
  • use administration screens and permission-controlled actions;
  • run scheduled jobs, imports, exports, queues and API integrations;
  • confirm redirects, cookies, logging and error reporting.

Use a production-like staging copy with sanitised data, a separate database and detailed logs. Automated tests are valuable, but a short manual walkthrough by the people who operate the system often catches assumptions that are absent from the codebase.

Release it as an operational change

Agree on a deployment window, named decision-maker, verified database and file backups, rollback trigger and post-release monitoring period. Test the rollback procedure before launch; ā€œwe have a backupā€ is not the same as knowing how long restoration takes or which transactions could be lost.

The successful outcome is not merely a higher version number. It is a supportable application with known dependencies, repeatable deployment, tested business journeys and a realistic maintenance path. If you have inherited a PHP 5 system and need help deciding whether to migrate, stabilise or replace it, Greg can provide a focused technical audit and a practical delivery plan.

Related on GrN.dk

  • MariaDB 10.6 EOL: quiet CMS hosting debt needs a real upgrade plan before July 2026
  • Apache 2.4.68 Is a Reminder That Old Proxy Rules Need a Real Audit
  • Why Your Website's Third-Party Stack Needs a Real Owner

Need help with this kind of work?

Discuss your PHP migration with Greg Get in touch with Greg.

Sources

  • PHP: Supported Versions
  • PHP: Unsupported Branches
  • PHP Manual: Migrating from PHP 5.6.x to PHP 7.0.x
  • Composer Command-line Interface
  • PHPCompatibility for PHP_CodeSniffer
Last modified
2026-07-23

Tags

  • php
  • Legacy Systems
  • PHP migration
  • Technical Debt
  • Application modernisation
  • Log in to post comments

Review Greg on Google

Greg Nowak Google Reviews

 

Illustrated infographic summarizing: AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
2026-07-23

New AI admin APIs can automate access and spend controls, but reliable governance still starts with authoritative directory data and clear ownership.

Illustrated infographic summarizing: OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
2026-07-22

Before an AI agent can take on real work, its workflow needs clear scope, permissions, handoffs, evaluation cases, and production monitoring.

Illustrated infographic summarizing: Chatbot Transcripts Quietly Became a Retention and Redaction Problem
Chatbot Transcripts Quietly Became a Retention and Redaction Problem
2026-07-21

Chatbot transcripts spread across providers, logs and support tools. Here is how to map each copy, redact sensitive data and test deletion properly.

Illustrated infographic summarizing: Cloudflare Service Keys Stop in September: Find Every Caller
Cloudflare Service Keys Stop in September: Find Every Caller
2026-07-20

Cloudflare Service Keys stop working on September 30, 2026. Here is how to find every caller, move to scoped API tokens and avoid a late outage.

Illustrated infographic summarizing: Your AI Workflow Needs an Acceptance Test Before It Meets Customers
Your AI Workflow Needs an Acceptance Test Before It Meets Customers
2026-07-19

A practical way to test AI workflows using realistic scenarios, tool checks, human rubrics, regression suites, and clear release gates.

Three cover candidates for The Goats Were Load-Bearing fanned on a dark background: an ember-lit door, three slow knocks, and a founders' ledger
The Goats Were Load-Bearing: a fantasy where the bill always comes due
2026-07-19

A teaser for the upcoming darkly comic fantasy novel The Goats Were Load-Bearing — a village, a door that must stay poor, and the worst possible time to sell the herd. Readers pick the cover.

Vegan Power game: the yellow player catches falling fruit while a chicken and a cow look on
Vegan Power: The Little Game About Eating Fruit, Not Friends
2026-07-19

Vegan Power is a free browser game where you catch fruit, dodge the animals, protect seven hearts, and chase a better high score.

KotobaMon title screen: the Japanese logo ć‚³ćƒˆćƒćƒ¢ćƒ³ over a low-poly 3D island with monsters, cherry-blossom trees and a trainer.
KotobaMon: Shipping a 3D Browser Game With No Build Step and Self-Hosted Voice
2026-07-19

A look at fantasy.grn.dk, a browser-based 3D game that teaches Japanese with no build step, procedural art and self-hosted AI voice, and what its constraints show about shipping interactive products fast and cheap.

Illustrated infographic summarizing: WordPress Forced an Emergency Update. Did Every Site Take It?
WordPress Forced an Emergency Update. Did Every Site Take It?
2026-07-18

WordPress pushed an emergency security update, but teams still need to confirm the right patched version and core integrity on every installation.

Illustrated infographic summarizing: IndexNow: Wire corrections and deletions into the CMS
IndexNow: Wire corrections and deletions into the CMS
2026-07-17

IndexNow works best when CMS workflows report updates, redirects and removals as well as new pages. Here is how to cover the full content lifecycle.

More articles
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.