Mod_lsapi for Apache

For many years, Apache has been enjoying the numero uno position in the web server market with IIS at second place According to Netcraft, Apache’s market share is over 37% and IIS’ market share is over 33%. There are other web servers slowly gaining hold in the market.

While Apache has been the most obvious choice for hosters and system administrators, it is very slow compared to many other web servers while serving PHP pages. I have listed a few options to run PHP under Apache with their limitations.
RUID2 + mod_php – is a giant security hole that lets any user get a root account
MPM ITK – is very slow, as it kills processes after each request
suPHP & CGI – are both slow, as they start PHP on each request. They are also incompatible with opcode caching.
FastCGI – creates a lot of stability issues, hard to configure due to the way it handles processes, and doesn’t use opcode caching optimally.
PHP FPM – needs a socket/startup per customer, not that stable with Apache and creates a mess when tried to integrate it with PHP Selector – as now PHP selector would have to restart PHP FPM processes.

In the web hosting market, another web server is slowly gaining foothold and it is Litespeed. Litespeed is one of the fastest web servers and it supports all the directives of Apache and thus proves to be the ideal replacement to Apache. Litespeed has its own module called lsphp to serve PHP Pages and also the Litespeed API is much faster than Apache and uses very less resources. The only downside of Litespeed is its price against the free Apache which prevents hosters to switch to Litespeed. Litespeed also has its open source version but it is not compatible with cPanel, DirectAdmin and Plesk and hence cannot be used in shared hosting servers.

Luckily, CloudLinux has used a few parts of PHP process management and communication protocol open sourced by Litespeed Tech and developed mod_lsapi, an Apache Module to serve PHP. While Apache is still slower than Litespeed API, mod_lsapi makes serving PHP faster.

Some of the benefits of mod_lsapi comparing to other ways to serve PHP are listed down in CloudLinux’s blog:

  • Speed – it is faster than any other way to serve PHP with Apache
  • Stability – it doesn’t suffer from stability issues in process management like PHP FPM
  • Utilizes full benefits of opcode caching
  • MPM Worker & Event compatible
  • Support for PHP directives in .htaccess files
  • Drop in replacement for existing ways to serve PHP
  • Fully compatible with PHP Selector

The software is currently in beta stage, and you can find more info on how to deploy it here:

Leave a Reply

Your email address will not be published. Required fields are marked *

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.