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_VERSIONbehind 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
- Composer Modernization Center Add Composer to legacy PHP projects, migrate includes to autoloading, set platform constraints, and replace a…
- PHP 5 to Modern PHP: Complete Incremental Migration Guide A deep, production-minded path from PHP 5.x codebases to supported PHP 8.x: removed extensions, charset, PDO,…
- PHP Security Modernization for Legacy Applications Upgrade inherited PHP security practices: prepared statements, password hashing, sessions, CSRF, XSS escaping…
- PHP 7 to PHP 8 Migration Guide Deep guide to PHP 8.0 breaking changes that matter for PHP 7 applications, with upgrade tactics through suppo…
- Inheriting a Legacy PHP Application A first-30-days playbook for developers handed an unfamiliar PHP codebase: runtime truth, risk triage, and sa…