Choosing a PHP version: compatibility and support dates

How to pick a PHP version for your site, what changed between 7.4 and 8.x that breaks old code, and why staying on old versions is risky.

ExplainerIntermediate2 min readUpdated

Use the newest version your site runs correctly on. The question is how to find it.

Support, in brief

The PHP project supports each version for a limited time: active bug fixes first, then security fixes only, then nothing. PHP 7.4 and 8.0 no longer receive official security fixes; later 8.x versions are supported for longer. Check the official PHP “Supported Versions” page for current dates.

What commonly breaks moving from 7.4 to 8.x

ChangeTypical error
Stricter handling of wrong argument typesTypeError or ValueError
Removed deprecated functionsCall to undefined function
Warnings promoted to errorsCode that “worked” now stops
Accessing undefined array keys or propertiesWarnings flood logs (usually harmless)
Dynamic properties deprecated (8.2)Deprecation notices

Choosing

  1. Check your application’s requirements page. WordPress core, current plugins and modern frameworks support recent 8.x versions.
  2. Update the application first.
  3. Switch on a staging copy, or during a quiet period with a backup. How to change the PHP version in DirectAdmin
  4. Read the error log for fatal errors after switching. Deprecation notices can wait; fatal errors can’t.

Custom or old code

Code written before 2019 often needs changes for PHP 8. The error log tells you exactly which line. If a site can’t be updated, it’s carrying security risk that grows every year.

Everything in this guide works on Traxio’s PHP hosting, which is free for 30 days and £0.99 a month after that.

Popular

Tip: press / to search from any pageSee all results