Overview
The PHP command-line interface is useful for maintenance scripts, scheduled jobs, development checks and deployment workflows.
Common commands
php -vdisplays the CLI PHP version.php -mlists loaded extensions.php --inishows configuration file locations.php -l file.phpchecks PHP syntax without executing the script.php script.phpruns a PHP script.php -S 127.0.0.1:8000starts the built-in development server.php --ri pdo_mysqldisplays information about an extension.
Environment awareness
The CLI binary and web server may use different PHP versions or configuration files. Verify both environments when diagnosing hosting issues. Do not expose the built-in development server directly to the public internet.