PHP Command Line Tools - Quick Reference

A quick reference guide for common PHP command-line tools and utilities. 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.

Basic Commands

# Check PHP version
php -v

# List installed PHP modules
php -m

# Display phpinfo() information
php -i

# Lint a PHP file
php -l file.php

# Lint all PHP files in the current directory
find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l

Interactive Shell and Web Server

# Start an interactive shell
php -a

# Start a local web server on port 3000 (PHP >= 5.4)
php -S localhost:3000

Finding Configuration Files

# Locate php.ini files
php -i | grep "php.ini"

Further Resources

For more detailed information, refer to the following resources: