Php SAPI, CLISAPI, CGISAPI, php SAPI, cli sapi, CGI SAPI
Http://www.cnblogs.com/yjf512/p/3482040.html
First, run php-r 'echo 12; 'in the command line ;'
The console prints 12;
Isn't this a wonderful process? I entered shell commands, but executed php scripts. After the php script is executed, the output can also be output on the console.
There must be an interface between this shell command (Console Command) and php to convert shell parameters, code, and so on to php, then convert the php output to the shell output. This Interface is called the SAPI (Server Application Programimg Interface ). It is equivalent to the proxy of the PHP external environment.
So because PHP can be applied to terminals or Web servers, SAPI of applications on terminals is called cli sapi, the application in the Web server is called cgi sapi. After installing php in windows, you will see two sdks: php.exeand php-cgi.exe. For example, if you use php-v on the console, you will find that the PHP version information has a (cli) identifier, which means that your php application uses cli SAPI.
About cli sapi: The manual has a very detailed description: http://php.net/manual/zh/features.commandline.php