PHP sapi,cli sapi,cgi SAPI

Source: Internet
Author: User
Tags sapi
PHP sapi,cli sapi,cgi SAPI

Http://www.cnblogs.com/yjf512/p/3482040.html

First question: Execute at the command line: Php-r ' echo 12; '

The console will print 12;

This is not a wonderful process, I typed in the shell command, but the PHP script is executed. The output from the execution of the PHP script will also be output at the console.

There must be an interface between this shell command (console command) and PHP, which translates the shell's parameters, code, and so on into PHP, and then translates the output of PHP into the output of the shell. This interface is called SAPI (Server application programimg Interface). It is equivalent to the PHP external environment of the agent.

So because PHP can be applied to the terminal, but also can be applied to the Web server, so, the application of SAPI on the terminal is called the CLI SAPI, applied in the Web server is called CGI SAPI. Install PHP under Windows you will see two exe:php.exe and Php-cgi.exe this corresponds to these two kinds of SAPI. For example, using PHP-V on the console, you will find that PHP version information has a (CLI) flag, which means that your PHP application here is using the CLI SAPI.

About the CLI SAPI: The manual has a very detailed description: http://php.net/manual/zh/features.commandline.php

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.