Stay on a supported PHP branch (e.g. 8.x). Test apps in staging before upgrading. Check extensions and deprecated features. Many hosts offer multiple PHP versions per site; use that for gradual migration.
Supported branches
- Active support: PHP 8.x (e.g. 8.2, 8.3) receive security and bug fixes. Stay on the latest minor within a major you use. Avoid EOL branches (e.g. 7.4 is EOL as of Nov 2025; check php.net/supported-versions).
- Upgrade path: Plan to move to a supported major before EOL. Test in dev and staging; fix deprecations and incompatible code; then upgrade production. Do not wait until the last month—supply chain and testing take time.
- Host support: Many shared and managed hosts offer multiple PHP versions (e.g. 7.4, 8.1, 8.2) per site or account. Use that to run one site on 8.2 while you migrate another from 7.4.
Testing before upgrade
- Staging: Deploy the same app (or copy of prod) on the target PHP version in staging. Run full test suite and manual smoke tests. Pay attention to custom code and third-party packages—check their compatibility notes.
- Extensions: Ensure all required extensions are available and at a compatible version. Some extensions are bundled; others (e.g. Redis, ImageMagick) may need to be installed or enabled.
php -mandcomposer showhelp. - Deprecated features: PHP 8 introduced strict types, named args, and many deprecations. Fix deprecation notices in logs; they can become errors in the next major. Use static analysis (e.g. PHPStan) to catch issues early.
Gradual migration
- Per-site or per-app: If you have many sites or apps, migrate one at a time. Use host's multi-version feature to switch one site to 8.x while others stay on 7.x. Reduces risk and allows learning from the first migration.
- Dependencies: Update Composer dependencies to versions that support the target PHP.
composer updateand run tests. Some legacy packages may have no PHP 8 support—plan replacement or fork. - Documentation: Document the PHP version per environment and the upgrade runbook. So the next person (or you in a year) knows how to repeat the process.
Summary
Stay on a supported PHP branch (e.g. 8.x). Test apps in staging before upgrading. Check extensions and deprecated features. Many hosts offer multiple PHP versions per site; use that for gradual migration.




