Article

How to Determine the PHP Version in Production

Reliable ways to identify the PHP version actually serving web and CLI traffic—including panels, containers, and split SAPIs.

Wrong version assumptions waste upgrade weeks. Web FPM and CLI often differ; panel “PHP 8” selectors may not match the pool handling your vhost. Verify each surface.

CLI and cron

php -v
php -r 'echo PHP_VERSION, "\n";'
which -a php
# cron may use an absolute binary — inspect the crontab line

Web SAPI

  • Temporary script returning only PHP_VERSION behind auth / IP allowlist (remove immediately).
  • Framework diagnostics (Laravel php artisan about, Symfony about) when available.
  • Container image tags and orchestrator manifests—confirm the running digest, not just the compose file on disk.
# MODERN throwaway probe (delete after capture)
<?php
header('Content-Type: text/plain');
echo PHP_VERSION, PHP_EOL;
echo PHP_SAPI, PHP_EOL;

Interpret the number

Compare against supported versions. As of 2026-08-09, supported lines are 8.2–8.5. Anything else is EOL for planning purposes. Use compatibility tables and the migration center to choose the next hop.

Scanner assist: compatibility checker.

Related scanners: PHP Version Compatibility Checker · PHP Deprecated Checker.

Related reading