FastCGI, suPHP, and mod_php: What are They?

FastCGI, suPHP, and mod_php: What are They?

When external applications interact with web server, they usually don’t do it directly. There are protocols in place that make it happen. The reason being safety and speed. But for the same function, there are multiple available options.

As PHP handlers, FastCGI, suPHP, and mod_php are all intended to do the same job. But what are they and which one should you use? Let’s find out in this article.

What is FastCGI?

FastCGI was designed by the Open Market to replace the CGI (Common Gateway Interface). It is a protocol for that allows outside apps to connect with the web server. The primary role of FastCGI is to reduce the overload on the server when handling requests. With FastCGI, the server is able to handle more requests simultaneously.

Unlike CGI, FastCGI processes aren’t closed at the end of each request. Instead, they remain on hold to handle new incoming requests. This greatly increases efficiency while reducing server load.

Here are the pros and cons of FastCGI:

  • Apache can be threaded in a safe manner
  • Apache can be threaded separately from PHP
  • Easily isolated by the user or the environment
  • Doesn’t support ‘php_value’ in ‘.htaccess’
What is mod_php?

mod_php is an Apache module to execute PHP scripts. With this, the Apache web server is able to execute PHP files. It has its own set of pros and cons.

  • Various PHP settings can be used directly from ‘.htaccess’
  • High memory consumption
  • Cannot be separated by environment or user
  • Can’t run Apache with Worker and PHP can’t be compiled with threaded safe since various modules won’t be functioning
What is suPHP?

suPHP is another tool that allows you to execute PHP scripts in Apache. When the web server receives a request, it passes it through suPHP. The tool then processes the request as per the environment. Once complete, the web server then returns the requested information to the user. After the request is delivered, the php process ends.

  • You can thread Apache safely separately from PHP
  • Can be isolated by user
  • Doesn’t support ‘php_value’ in .htaccess
FastCGI was created to replace CGI. During the same time, modules like mod_php and mod_perl emerged to do the same job.

When it comes to performance, FastCGI is superior to suPHP. But mod_php is faster than both FastCGI and suPHP. But this isn’t a rule and depends on many factors. That being said, we hope you have a better understanding of the three PHP handlers.
First release
Last update
0.00 star(s) 0 ratings

More resources from kumkumsharma