---
title: "mod_lsapi"
source: "https://docs.nexcess.com/hosting/server-administration/linux/apache-web-server/mod_lsapi/"
description: "Boost Apache PHP speed with `mod_lsapi` on EasyApache 4. LiteSpeed's handler offers faster performance & lower memory use, even without LiteSpeed Web Server."
vertical: "Hosting"
date: "2025-05-30"
last_modified: "2026-06-30"
---

# mod_lsapi

#### Using mod\_lsapi with EasyApache 4 (without LiteSpeed)

##### Overview

mod\_lsapi is LiteSpeed Technologies’ high-performance PHP handler, now available on **EasyApache 4**, even if LiteSpeed is not installed. It works similarly to FCGI, but instead of Apache managing the PHP processes, mod\_lsapi uses independent backend pools. This improves performance and memory handling.

It’s especially useful for servers that want better PHP speed without switching to LiteSpeed or using suPHP.

##### Why Use mod\_lsapi?

- Faster than suPHP and FCGI
- Lower memory usage due to smart process handling
- Supports opcode caching and persistent PHP processes
- Compatible with CageFS and CloudLinux PHP Selector

##### Installation

To install `mod_lsapi` on CentOS with EasyApache 4:

```
yum install ea-apache24-mod_lsapi
```

NoteYou do **not** need LiteSpeed installed. This package works with Apache under EA4.

##### Configuration

##### Default configuration file

- **Do not edit:**  
    `/etc/apache2/conf.d/lsapi.conf`
- **Custom changes should go in:**  
    `/etc/apache2/conf.d/includes/pre_virtualhost_global.conf`

##### Example custom configuration

Add the following block to control the number of PHP backend children and their idle timeout:

```
<IfModule lsapi_module><br></br>  lsapi_backend_children 20<br></br>  lsapi_backend_max_idle 3<br></br></IfModule>
```

**Recommendations:**

- `lsapi_backend_children`: Increase this based on your server’s available RAM.
- `lsapi_backend_max_idle`: Reduce idle time to lower memory use (default: 300 seconds).

---

##### Important directives  
`lsapi_backend_children`

- Max child PHP processes per domain.
- Default: **5**
- Logs error if limit is hit: arduinoCopyEdit`Reached max children process limit: 5...`

### `lsapi_backend_max_process_time`

- Max request processing time (in seconds).
- Default: **300**
- If exceeded, logs will show: vbnetCopyEdit`Error... timeout 300 is exceeded Killing runaway process...`

Also, ensure `Timeout` in Apache config is high enough for long-running tasks.

##### Logging

- **mod\_lsapi error log:**  
    `/var/log/apache2/lsphp-stderr.log`
- **General Apache error log (timeout messages):**  
    `/var/log/apache2/error_log`

##### CloudLinux integration

- **Fully supported** with CloudLinux + CageFS + PHP Selector + alt-php
- Run this after updating PHP module selections:

```
/usr/bin/switch_mod_lsapi --build-native-lsphp
```

##### Per-Folder PHP versions

**mod\_lsapi**: Limited to 2 PHP versions per account (due to persistent processes)  
Use only if the default handler is set to **FCGI**

**suPHP** (CloudLinux): No limit on versions

Reference: [Official Documentation](https://cloudlinux.com/getting-started-with-cloudlinux-os/40-stability-features/932-mod-lsapi-installation-configuration/)

##### Summary

**mod\_lsapi** is a high-performance PHP handler by LiteSpeed, available for EasyApache 4 without requiring LiteSpeed itself. It offers faster execution and lower memory usage than suPHP or FCGI by using independent PHP process pools. It supports CloudLinux, CageFS, and PHP Selector, with limited support for multiple PHP versions per account.
