PHP Command Line Interface

PHP CLI vs. PHP CGI

In many ways, the CLI SAPI works in the same way as the CGI SAPI and other SAPIs. However, it is important to keep track of where it differs and why, because it will directly affect how you write your scripts.
These are the most important differences between CLI and CGI: