Why PHP versions matter
PHP releases are organised into branches such as 8.4 or 8.5, with patch releases inside each branch. Newer branches can introduce language features and compatibility changes; patch releases can fix bugs and security issues. Hosting, frameworks and libraries may support different branches, so check their requirements before changing a project.
The PHP project gives each branch two years of active support, followed by two years of support for critical security issues only. After that, it reaches end of life (EOL) and no longer receives official fixes. Use the newest patched release of an actively maintained branch that your application and host support; update an existing project deliberately and test it before deployment.
Supported branches as checked on 23 October 2026
This table is a dated snapshot of the official PHP supported-versions page, not a permanently current status indicator. Consult that page before installing or upgrading. On this date, 8.5 and 8.4 are actively supported; 8.3 and 8.2 receive critical security fixes only. PHP 8.1 and older are end of life. A branch being supported does not mean an old patch release is safe: install the latest available security patch for that branch.
For a new beginner project today, a latest patched PHP 8.5 release is a sensible starting point if your operating system, hosting and dependencies support it. PHP 8.4 remains actively supported as of this check. This recommendation will age, so follow the linked live support table rather than copying a branch number indefinitely.
| Branch | Status on 23 Oct 2026 | Active support ends | Security support ends |
|---|---|---|---|
| 8.5 | Active support | 31 Dec 2027 | 31 Dec 2029 |
| 8.4 | Active support | 31 Dec 2026 | 31 Dec 2028 |
| 8.3 | Security fixes only | 31 Dec 2025 | 31 Dec 2027 |
| 8.2 | Security fixes only | 31 Dec 2024 | 31 Dec 2026 |
| 8.1 and older | End of life | Past | Past |
Check the PHP you actually run
Run php -v to see the version of the command-line PHP executable. Run php -m to list loaded extensions, and php --ini to see which configuration file that CLI executable reads. If the terminal says php is not recognised, PHP may not be installed or on PATH.
A hosting account can run a different PHP branch, SAPI (server API), php.ini or extension set from your terminal. The PHP_VERSION and PHP_SAPI constants in the example below tell you what that particular process is running. If diagnosing a web environment, use a temporary, access-restricted diagnostic page and remove it afterward; do not publish a detailed phpinfo page or configuration secrets.
Check command-line PHP version
php -vList command-line extensions
php -mFind the command-line configuration
php --iniExtensions and compatibility
An extension adds capabilities to a PHP installation. For example, PDO provides a database-access interface, while a particular PDO driver provides access to a particular database. Code can have the right PHP version and still fail if a required extension or driver is missing. Check the project’s requirements and the loaded extensions in the environment that executes it.
A feature may also have a minimum PHP version. The match expression was introduced in PHP 8.0, enums in 8.1 and readonly classes in 8.2. These are examples of version requirements, not a suggestion to target an unsupported release. Use a supported branch and verify any specific feature in the official manual or migration guide.
Choose and upgrade with care
For a new project, choose an actively supported branch, then install its latest patched release using an official or trusted platform package. Before upgrading an existing application, check framework and package constraints, required extensions, deprecation notices and migration guides. Test in a development or staging environment, including real requests and database operations, before switching production traffic.
If your host only offers an EOL branch, ask for an upgrade or choose hosting that can run a supported release. Do not assume a version number in a tutorial reflects the current support state; the official supported-versions page is the source to revisit.
Syntax
php -v
php -m
php --iniExamples
Inspect this PHP process and a required extension
Save as environment.php and run php environment.php; values depend on your installation.
<?php
echo 'PHP version: ' . PHP_VERSION . PHP_EOL;
echo 'Execution environment: ' . PHP_SAPI . PHP_EOL;
echo 'PDO extension: ' . (extension_loaded('pdo') ? 'available' : 'missing') . PHP_EOL;
- PHP_VERSION reports the release of the process running this file. PHP_SAPI identifies its interface; a terminal run usually reports cli, while web execution may differ.
- extension_loaded checks for PDO in this process. “Available” only establishes that PDO itself is loaded; a database connection can still need a separate PDO driver.
- PHP_EOL adds a line ending. Compare the output with php -v and php -m, then check the corresponding web environment if the application runs behind a server.
Best practices
- Check the live PHP supported-versions page before choosing a release; the dated table here will eventually become stale.
- Install security patches within your supported branch and test upgrades against dependencies and extensions.
- Check the PHP version and extensions in the actual execution environment, not only on your laptop’s command line.
Runtime & versions
PHP runtime on a server or CLI. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
PHP Manual