PHP index.php not effective after modification

Source: Internet
Author: User

PHP index.php not effective after modification

PHP Project modified the code inside the index.php, after the submission of the server, the code function is not effective,

Workaround: Restart FPM

The command is as follows:

/ETC/INIT.D/PHP5-FPM restart

Reasons need to understand the following:

1, CGI is to ensure that the data passed by the Web server is a standard format, convenient for CGI program writers.

When the Web server (for example, Nginx) receives /index.php this request, it launches the corresponding CGI program, which is the parser for PHP. The PHP parser then parses the php.ini file, initializes the execution environment, then processes the request, and then returns the processed result in a format specified by the CGI, exiting the process. The Web server then returns the results to the browser. CGI is a protocol, it doesn't matter what the process is.

2, fastcgi is used to improve the performance of CGI programs.

So what is the performance problem with CGI programs? "The PHP parser parses the php.ini file, initializes the execution environment," and here it is. The standard CGI performs these steps for each request (no idle fatigue!). Start the process very tired to say! ), so it takes longer to process each time. This is obviously unreasonable! So how did fastcgi do it? First, fastcgi initiates a master, parses the configuration file, initializes the execution environment, and then starts multiple workers. When the request comes in, master passes it to a worker, and then immediately accepts the next request. This avoids duplication of labor, and efficiency is naturally high. And when the worker is not enough, master can pre-boot several workers according to the configuration and so on, of course, the idle worker too much, will also stop some, this improves the performance, also saves the resources. This is FastCGI's management of the process.

3, PHP-FPM is a realization of the FASTCGI program

PHP-CGI is just a CGI program, his own can only parse the request, return results, not process management, PHP_FPM is the scheduling php-cgi process, php-fpm management object is php-cgi. But it cannot be said that PHP-FPM is the manager of the fastcgi process, because the fastcgi is a protocol, it seems that no such process exists, even if there is php-fpm can not manage him (at least for now).

Reference Link: http://www.mike.org.cn/articles/what-is-cgi-fastcgi-php-fpm-spawn-fcgi/

PHP index.php not effective after modification

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.