Article
Migrating from PHP 5 to PHP 8
End-to-end view of jumping PHP 5 codebases toward supported PHP 8.x without skipping mechanical removals.
Going “straight to PHP 8” from PHP 5 is possible only if you still perform the PHP 7 removals—8.x will not resurrect mysql_* or ereg. This page is the long-jump map; the deep playbook remains PHP 5 to modern PHP.
Two cliffs, one program
- 7.0 cliff: ext/mysql, ereg/split, assorted 5.x APIs.
- 8.0 cliff:
each,create_function, constructors, comparison changes, fatal promotions.
Mcrypt is a 7.2 cliff of its own if cryptography is in-band. Plan ciphertext re-encryption offline.
# TRANSITIONAL CI matrix idea
# jobs: php74-legacy-shim, php83-target
# php74 job proves mysql_/ereg gone
# php83 job proves each/create_function/dynamic props addressed
Supported landing zones
Do not celebrate an 8.0 container in 2026. Prefer 8.2–8.5 per supported versions. See stepwise guides from 8.0→8.1 onward.
Scanners: compatibility, deprecated. Errors hub: PHP Errors.
Related reading
- Composer Modernization Center Add Composer to legacy PHP projects, migrate includes to autoloading, set platform constraints, and replace a…
- PHP 5 to Modern PHP: Complete Incremental Migration Guide A deep, production-minded path from PHP 5.x codebases to supported PHP 8.x: removed extensions, charset, PDO,…
- PHP Security Modernization for Legacy Applications Upgrade inherited PHP security practices: prepared statements, password hashing, sessions, CSRF, XSS escaping…
- PHP 7 to PHP 8 Migration Guide Deep guide to PHP 8.0 breaking changes that matter for PHP 7 applications, with upgrade tactics through suppo…
- Inheriting a Legacy PHP Application A first-30-days playbook for developers handed an unfamiliar PHP codebase: runtime truth, risk triage, and sa…