Skip to main content

PHP Command Line Interface (CLI).

# To parse and execute a php script:
php file

# To check syntax on (i.e. lint) a PHP script:
php -l file

# To run PHP interactively:
php -a

# To run PHP code (Notes: Don't use <? ?> tags; escape double quotes with backslash):
php -r "code"

# To start a PHP built-in web server in the current directory:
php -S host:port