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

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

By Greg Nowak. Updated 9 September 2026.

If your website or internal system still runs PHP 5, the difficult part of upgrading is usually discovering what might stop working. Orders, customer accounts, scheduled exports and custom integrations all need to survive the change. For a business owner or agency inheriting the system, that uncertainty makes the project hard to price and approve.

A useful migration plan turns those unknowns into decisions: what to keep, which dependencies to replace, what to test and who can authorise launch. PHP 7 can sometimes help diagnose old code along the way, but the production destination should be a supported PHP 8 release.

Choose the destination before planning the bridge

Every PHP 5 and PHP 7 branch is unsupported by the PHP project. PHP 7.4 reached end of life on 28 November 2022, according to PHP’s unsupported branches register.

As of September 2026, PHP 8.2 through 8.5 remain supported. However, 8.2 receives security fixes only until 31 December 2026. PHP 8.4 has security support through December 2028, and 8.5 through December 2029. Check the official support schedule when agreeing the target.

My starting shortlist would be PHP 8.4 or 8.5, subject to the CMS, framework, hosting and extensions supporting it. If a required component blocks both, give that dependency its own replacement or upgrade plan. Otherwise, the project can finish with another urgent migration already approaching.

Decide whether to migrate or replace

A small brochure site with abandoned plugins may be cheaper to replace. A bespoke ordering system may contain business rules that would be expensive to rediscover. Compare the cost of preserving those rules with the cost of rebuilding them, including data migration and staff retraining.

Starting position Practical route First deliverable
CMS with a maintained upgrade path and little custom code Follow the CMS upgrade sequence, then test on supported PHP 8 Compatible core and extension list
Custom application with valuable business logic Migrate in reviewed batches; use isolated PHP 7 testing if helpful Dependency map and phased estimate
Revenue-critical system with few tests Capture essential workflows and rehearse recovery before release Acceptance checklist and rollback plan
Small application built around abandoned components Compare replacement with migration, including data export Costed recommendation
Choose the route from the system’s business value and maintenance options.

Ask for a bounded discovery phase before committing to the full build. Its output should identify blockers, assumptions, scope and acceptance criteria. That gives owners a basis for approving spend and agency teams a clearer boundary for delivery.

Inventory the application and its dependencies

Record the PHP version, operating system, database, web server, extensions, CMS or framework, custom code, libraries, cron jobs and integrations. Ask operations staff about occasional tasks: a monthly export deserves a test even if nobody uses it during a normal demonstration.

These commands identify the command-line PHP environment:

php -v
php --ini
php -m

Check the web server’s PHP configuration separately; it can differ from the command line. For a Composer-managed project, inspect a working copy using a tooling environment that supports your Composer version:

composer validate
composer outdated --direct
composer prohibits php 8.4
composer audit --locked

Replace 8.4 with your target. The Composer CLI documentation explains these checks: declared dependency blockers and reported vulnerabilities help define the work, but do not prove application compatibility. The locked audit requires a lock file; use composer audit to inspect installed packages instead.

After installing the proposed dependencies under the target runtime, run:

composer check-platform-reqs

This checks actual PHP and extension requirements, ignoring Composer’s simulated config.platform setting. Keep dependency updates reviewed and reproducible in the lock file; avoid an unplanned composer update on production. Libraries copied into the project manually need a separate inventory.

When does PHP 7 help?

A temporary PHP 7.4 environment can help separate earlier compatibility failures from later ones. PHP’s PHP 7 migration notes document changes including removal of mysql_* and ereg* functions and changes to error behaviour.

Use that checkpoint only when it makes diagnosis easier. Keep it private, short-lived and disconnected from live payment, email and customer systems. If the application’s upgrade path supports moving directly to your PHP 8 target, skip the intermediate runtime. Either route still requires reviewing the migration notes for the versions crossed.

Scan the code, then test the business

PHPCompatibility can flag version-sensitive code without running the application. Install it according to its current instructions in a suitable development environment; the scanner can run on a newer PHP version than the code being inspected. With the standard registered, a scan for PHP 8.4 could be:

vendor/bin/phpcs -ps /path/to/application \
  --standard=PHPCompatibility \
  --runtime-set testVersion 8.4

Replace the path and target. Use 7.4-8.4 only if the code must support that whole range, rather than to describe the migration journey. Coverage is incomplete, so treat findings as a work list. Authentication and encryption changes need particular care to preserve access to existing accounts and data.

On production-like staging with sanitised data, separate storage and sandbox integrations, test complete workflows:

  • Sign in, reset passwords and check permissions.
  • Submit forms, upload files and verify email delivery.
  • Place orders, process test payments, refund and generate invoices.
  • Run scheduled jobs, queues, imports, exports and API integrations.

Record expected results and have the staff responsible for those processes approve them.

Make launch and recovery part of the scope

Agree the deployment window, decision-maker, rollback triggers and monitoring owner. Rehearse restoring files and data. If customers can create orders after launch, decide how those transactions will be preserved or reconciled during rollback; restoring an older database can lose them.

Finish with documented dependencies, repeatable deployment and an owner for ongoing updates. If you need help choosing between migration and replacement, discuss your PHP system with Greg. Share the current version, what the application does and any hosting deadline to give the assessment a practical starting point.

Related on GrN.dk

Need help with this kind of work?

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

Sources

Latest articles

AI can identify termination deadlines and price adjustments in supplier contracts, route uncertain findings for approval and create the right reminders.

Why a DNS record can exist in a dashboard yet fail publicly—and how to trace zone cuts, verify glue, and fix the right side of a live delegation.

An Apache version below 2.4.68 may still be patched. Package provenance, vendor advisories, module checks and runtime evidence reveal the real position.

PHP 8.2 security support ends on December 31, 2026. Here is how to audit, test, and migrate a mixed CMS estate without rushing production changes.

How Danish businesses can automate Gmail and Microsoft 365 with rapid sorting, limited permissions and human approval.

When WordPress jobs run late, check WP-Cron and queue capacity first. Diagnose triggers, handlers, and Action Scheduler without guesswork.

WordPress 7.1 makes speculative loading configurable. Here’s how to spot overlapping rules and test speed gains without adding hidden costs.

Multiple records for the same customer in HubSpot? Learn how CVR number matching, AI suggestions and human approval can help you clean up duplicates while keeping track of fields, associations and customer history.

Before a Google AI shopping pilot, check which products qualify, where your catalog data disagrees, and whether checkout reflects your delivery and return terms.

Check whether prompt caching reduces cost per completed task, accounting for cache writes, retries, review effort and the charges on your provider's bill.