php -v tells you something true—just not always the version that serves your site. On servers with multiple PHP versions, CLI and PHP-FPM can differ, which leads to confusion when debugging.
Symptoms
- CLI scripts work; web requests fail (or vice versa)
- Version reports that don’t match what the site uses
Fix pattern
- Identify which PHP-FPM pool (and version) the site uses
- Align CLI expectations (e.g.
php8.2vsphp) or document the difference so you don’t assume CLI = web
FAQ
How do I know which PHP version the site uses?
Check the Apache vhost: it will point to a specific PHP-FPM socket or pool. That pool’s config (e.g. in /etc/php/8.2/fpm/pool.d/) is the version serving that site. See PHP version drift on multi-site servers for documenting and cleaning this up.
Related
- PHP version drift on multi-site servers — mixed versions and pool alignment