Article
Migrating from PHP 7.4 to PHP 8
Focused upgrade notes for the common PHP 7.4 production baseline moving onto PHP 8.x.
PHP 7.4 was the last PHP 7 release line and remains a frequent production pin. It already forbids many PHP 5 APIs, so the remaining work is mostly the PHP 8.0 engine breakages plus later 8.1/8.2 deprecations. Read migration80 alongside the deep 7→8 guide.
7.4-specific prep
- Enable notices in staging on 7.4 now—many 8.0 fatals warn earlier.
- Replace remaining
each()/create_function()while still on 7.4 (deprecated since 7.2). - Confirm typed properties and covariance changes already match your subclasses.
- Lock dependencies that claim
php: ^7.4|^8.0and test the 8.x side explicitly.
# LEGACY still common on 7.4
$fn = create_function('$x', 'return $x * 2;');
# MODERN
$fn = static fn($x) => $x * 2;
First production target
Boot on 8.1+ in CI, then choose a supported minor (8.2–8.5). Use the checklist as the deploy gate and scanners before cutover.
Related scanners: PHP Version Compatibility Checker · PHP Deprecated Checker.
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…