"PHP some professional vocabulary + concept Interpretation"

Source: Internet
Author: User
Tags php cli sapi

PHP weakly typed language, case sensitive, scripting language (explanatory, text file execution), server side.

OOP [Object Oriented programming]

SAPI [Server application programming Interface]

Link

Server-side application programming port. It is the interface between PHP and other applications, and PHP scripts can be executed in a number of ways, either through a Web server or directly under the command line or embedded in other programs.
SAPI provides an interface to external communication, common SAPI are: CGI, fast-cgi, CLI, ISAPI, Apache module DLL

CGI
CGI is a general-purpose Gateway Interface (Common Gateway Interface), which is a program in which the popular CGI is like a bridge, linking the Web page to the executing program in the Web server, It passes the instruction that the HTML receives to the server execution program, and then returns the result of the server execution program to the HTML page. CGI has excellent cross-platform performance and can be implemented on almost any operating system. The
CGI method encounters a connection request (user request) to create a CGI subprocess, activates a CGI process, then processes the request, and ends the child process after processing. This is the Fork-and-execute mode. So how many CGI sub-processes are there for the CGI server, and the sub-process loading is the main reason for the poor CGI performance. will be when the user requests a very long time, will be a lot of crowding out the system resources such as memory, CPU times, resulting in low performance.

FastCGI
fast-cgi is an upgraded version of CGI, FastCGI is like a resident (long-live) type of CGI that can be executed all the time, once activated, It's not going to take time to fork it every time. PHP uses PHP-FPM (FastCGI process Manager), the full name of the PHP FastCGI process Manager to manage.

How the FastCGI works


    1. Load fastcgi Process Manager (IIS ISAPI or Apache Module) when Web server starts

    2. The FASTCGI process Manager itself initializes, starts multiple CGI interpreter processes (visible multiple php-cgi) and waits for a connection from the Web server.

    3. When a client request arrives at the Web server, the FASTCGI process manager selects and connects to a CGI interpreter. WEB server sends CGI environment variables and standard input to the FASTCGI child process php-cgi.

    4. The FASTCGI child process returns standard output and error information from the same connection to the Web Server after processing is complete. When the fastcgi child process closes the connection, the request is processed to completion. The fastcgi child process then waits and processes the next connection from the FASTCGI process Manager (running in Web server). In CGI mode, php-cgi exits here.


Apache2handler
PHP as the Apache module, the Apache server after the system boot, pre-generated multiple copies of the process resides in memory, once a request appears, immediately use these spare child processes to process, Thus there is no delay caused by the generation of child processes. These server replicas do not exit immediately after processing an HTTP request, but instead stay on the computer waiting for the next request. Requests for customer browsers respond faster and have higher performance.
the DLL for the Apache module:
This is often used in a Windows environment that we used to use with Apache servers, and in a modular (DLL), PHP is started and run with a Web server. (It is an extension of Apache based on CGI, which accelerates the efficiency of PHP operation)

Isapi:
ISAPI is the Internet Server application program Interface, is a set of Internet service-oriented API interfaces provided by Microsoft. An ISAPI DLL can be in memory after being requested by the user, waiting for another request of the user, and can set up multiple user request handlers in a DLL, in addition, the ISAPI DLL application and the WWW server are in the same process. is significantly more efficient than CGI.

CLI: [Introduction to PHP CLI mode]
CLI is the command-line run mode of PHP, you will often use it, but may not notice (for example: we often use "php-m" under Linux to find PHP installed those extensions is the PHP command line running mode;


"PHP some professional vocabulary + concept Interpretation"

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.