PHP Command Line Tools - Quick Reference

A quick reference guide for common PHP command-line tools. Learn how to check your PHP version, list installed modules, lint your code, and more.

PHP Command Line Tools

This page provides a quick reference for common PHP command-line tools.

Checking PHP Version

php -v

Listing Installed Modules

php -m

Viewing phpinfo() Information

php -i

Linting a PHP File

php -l file.php

Linting All PHP Files in the Current Directory

find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l

Entering an Interactive Shell

php -a

Locating php.ini Files

php -i | grep "php.ini"

Starting a Local Web Server

php -S localhost:3000

This command starts a local web server on port 3000 for the current working directory. Requires PHP 5.4 or higher.

Remember to consult the official PHP documentation for more detailed information and advanced usage.

PHP Command Line Interface Documentation