Running PHP in CGI vs. FastCGI

The design differences between the two approaches are quite small, so you can try your very application with both.

In general, unless poor programming techniques get involved, FastCGI yields to better performance results than CGI at least because:

1. process start up fee is paid only once (scheduler allocates resources);
2. application initialisation and finalisation fees are paid only once (system resources, such as DB connections and file descriptors, get acquired but not released for every request)

I should warn however, that:

3. Even small memory leaks can lead to disasters in FastCGI;
4. The 'resource clean-up' among requests should be designed and implemented very carefully, otherwise it will cost more than a process cost to start up.

Therefore, to summarise, if you are certain that you have coded your site(s) to handle resources efficiently, closing sockets and cleaning up after execution, then FastCGI may produce better performance. However, if this is not the case, or you have any memory leaks in your code, then CGI will be safer.

Last update:
2011-07-18 14:55
Nick Fawbert
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Most popular FAQs RSS

  1. I require an additional IPv4 address. What is Bytehouse's ... (89039 views)
  2. The Most Common Problems When Migrating Websites (70208 views)
  3. How do I create a 301 redirect? (58163 views)
  4. Can I Backup Exchange 2010 with My Online Backup ... (55010 views)
  5. Steps to Add Administrator User for Windows Server (50114 views)

Latest FAQs RSS

  1. Steps to set/customize log rotation from plesk (2016-07-25 07:15)
  2. Generate a self-signed SSL certificate - Nginx,CentOS (2016-07-07 02:31)
  3. Procedure re-register Volume Shadow Copy Service(VSS) in a Windows ... (2016-07-05 04:18)
  4. Steps to Install Mcrypt in Plesk (2016-07-01 17:11)
  5. How to Retrieve a Plesk Password in Linux and ... (2016-07-01 17:09)

Regular new KB articles

Check back from time to time for new articles, or if you have any suggestions please feel free to recommend