The difference between Apache PHP and Nginx php

Source: Internet
Author: User
Tags apache php
Apache is through mod_php to parse PHP  Nginx is through PHP-FPM (fast-cgi) to parse PHP
1. PHP interpreter embedded in the WEB server process internal execution mod_php by embedding the PHP interpreter into the Apache process, only with Apache, and CGI and fast-cgi in the form of separate processes, as long as the corresponding WEB server implementation CG I, or fast-cgi protocol, will be able to handle PHP requests. mod_php This embedded way the biggest drawback is that the memory occupies a large, regardless of whether the PHP interpreter will be loaded into memory, typically processing CSS, JS and other static files is absolutely no need to load the interpreter. 2. The number of requests processed by a single process mod_php and fast-cgi patterns can handle multiple requests during the lifetime of each process (fast-cgi can adjust the number of processes as needed), while CGI mode processes a request to destroy the process immediately, in high concurrency scenarios, CGI The performance is very bad.

Every Web request PHP must re-parse php.ini, reload all DLL extensions, and initialize all data structures. With fastcgi, all of this happens only once when the process is started

In the comprehensive, if the performance has a high demand, can be static request and dynamic request separate, then Nginx + php-fpm is a better choice. ps:cgi, fastcgi usually refers to the protocol specification of the WEB server communicating with the interpreter, and PHP-FPM is an implementation of the FASTCGI protocol.

The difference between Apache PHP and Nginx 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.