PHP: What are the benefits of FastCGI over mod_php?

It was lately recommended to me that I make use of FastCGI with PHP. Currently I mosted likely to the FastCGI web page and also read it yet I do not actually recognize what the benefits are.

2019-05-18 22:50:42
Source Share
Answers: 3

FastCGI suggests that the php little bits aren't running in the very same procedure as the apache little bits, unlike with mod_php. This splitting up can have some precise benefits when it involves reactivating the web server or managing runaway applications - in the mod_php instance that suggests that it is the apache procedure that is "runaway", yet under fastcgi it is simply a procedure that apache is talking with, so the whole web server does not need to be removed.

2019-05-21 08:43:30

Another benefit not yet stated is the reality that with mod_fcgid (which is a more recent execution for making use of FastCGI on Apache) and also suexec you can understand arrangements where various vhosts make use of various Linux customers for implementation, which can be an actual protection advantage in a common organizing szenario.

With mod_php, all vhosts share the very same customer, which is Apache is customer. This can bring about protection concerns.

2019-05-21 08:14:03

Using mod_php each Apache employee has the whole PHP interpreter filled right into it. Due to the fact that Apache requires one employee procedure per inbound demand, you can promptly wind up with thousands of Apache employees in operation, each with their very own PHP interpreter filled, eating massive quantities of memory.

(Note, this isn't specifically real, Apache is worker_mpm permits you to offer several demands with a solitary threaded Apache employee. Nonetheless, also in 2009, this is not the advised means to release PHP as a result of believed threading concerns with the PHP expansions.)

By utilizing PHP in fast_cgi setting (making use of something like spawn-fcgi from the lighttpd plan) has the adhering to advantages

  • tune the variety of PHP employees independently from the variety of inbound links
  • permit you to place you PHP employees on a various web server, or range throughout several web servers without transforming you internet rate
  • offers you adaptability to pick a various internet server, like nginx, or lighttpd
  • permit you to run your PHP application in a various protection domain name on your internet server
2019-05-21 07:09:35