PHP Websites Supercharged With mod_lsapi


By: Drew Germyn

Categories: Announcements & Events, Hosting Servers

Load spikes, increases in traffic volumes and slow page loading are the primary causes of many a web host’s constant migraines. At the beginning of 2010 hosting companies running Apache Server were criticised for slow PHP page serving, they were becoming increasingly aware that these issues needed to be addressed soonest, and some were even actively considering commercial alternatives to open source Apache. Then along came CloudLinux’s mod_Isapi for Apache.

Without mod_Isapi, Apache’s dominance in the web server market could have been a little different today, and hosting plans a lot more expensive. Let’s go down memory lane and look at how mod_Isapi made such a significant impact.


While Apache Server has traditionally been the obvious choice for web hosting companies and system administrators, its detractors complained it was slow compared to many other web servers when it came to serving PHP pages, especially on shared hosting servers. Gaining in popularity, and one of the fastest commercial web servers on the market, was Litespeed. It was much faster than Apache and used LSPHP to serve PHP pages. Also, Litespeed could read Apache configurations directly which made it easy to integrate with existing products, making the process of transferring to a new server much simpler.

But Litespeed costs money (the standard version is free but has limitations), and most web hosts were understandably hesitant about moving from the tried and trusted open source Apache to a newcomer with a hefty price tag. Also, many Fortune 500 companies were using Apache or derivatives thereof, including Apple, Yahoo and Amazon; having to adopt a new server would be expensive and time-consuming. Clearly something needed to be done.

The solution

In 2014, Litespeed open-sourced parts of its PHP process management and communication protocol which CloudLinux then used to develop mod_Isapi, an Apache module to speed up PHP performance and serve web pages in much the same way that Litespeed did.

A few words about CloudLinux

CloudLinux is an award-winning OS, and there are many reasons for its popularity. It is particularly attractive on shared servers because it allows easy control over resources allocated per account and is very stable. It is also compatible with most software commonly used with CentOS and RHEL.

But CloudLinux is not only attractive to web hosts. Enterprises have adopted it too because CloudLinux tends to be secure, stable and reliable, with an excellent performance record.

How it works

  • mod_lsapi is a part of Apache and Apache passes handling for PHP request to mod_lsapi.
  • mod_lsapi uses liblsapi to transfer a request to LSPHP daemon.
  • LSPHP processes request and returns data to mod_lsapi. Each user has LSPHP processes in separate CageFS/LVE.
  • If there are no requests for ISAPI_backend_pgrp_max_idle_seconds, the LSPHP process is terminated.
  • If no LSPHP processes are available when a new request is made, a new LSPHP process is created.
  • LSPHP can process ISAPI_backend_children requests simultaneously.

Mod_Isapi benefits

  • Opcode caching – Stores machine code in a cache and executes (interprets) it when needed instead of constantly recompiling the source This speeds up websites considerably. Many of the most popular applications on hosted sites – like Magento, PrestaShop, and Joomla – support Opcode caches so it’s important a host can deliver this feature to customers needing optimal speeds for their e-commerce websites.
  • Stability – Doesn’t have stability issues in process management as does PHP-FPM (an alternative PHP FastCGI implementation traditionally used for very busy sites and designed to handle multiple requests) which requires a socket/ start-up for every customer.
  • PHP Selector – Fully compatible with PHP Selector, which is a CloudLinux component that sits on top of CageFS – a virtualised filing system that constrains accounts to their own ‘cages’ – and allows users to select a PHP version and module based on their needs. In short, mod_Isapi is a drop-in replacement for various other ways to serve PHP, e.g. SuPHP, RUID2, and FCGID.
  • ISAPI – Microsoft’s web server is also addressed in the mod_Isapi module so that server-side web applications written for Microsoft’s IIS can be used with Apache.
  • .htaccess – mod_Isapi understands PHP directives from .htaccess files – which are directory-level configuration files used for configuring site access issues, such as URL redirection, URL shortening and caching – that enable Apache to speed up page loading in different ways.


Discussion about mod_Isapi would not be complete without a few words about ISAPI (Internet Server API) itself. ISAPI was one of the earlier methods used by web servers to provide a more efficient way to interface with other programs than CGI (Common Gateway Interface). ISAPI functionality for Apache is via mod_Isapi. ISAPI applications have a number of advantages over external CGI applications. For instance, they are loaded into and run in the web server’s process space thereby eliminating the time and resource demands of creating additional processes. In addition, all data and resources available to the web server are also available to the ISAPI application.


Localnode runs CloudLinux because it’s fast, reliable and developed specifically to cater to the needs of web hosts. The clincher for choosing it is the mod_Isapi module which enables superior performance and thereby a distinct competitive advantage in the industry.