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

  1. 7.0 cliff: ext/mysql, ereg/split, assorted 5.x APIs.
  2. 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