How to Install Mod_lsapi on CloudLinux

Mod_lsapi is a high performance Apache module that is based on the technology behind the LiteSpeed web server. It’s a drop-in replacement for suPHP, but it can also serve Ruby and Python scripts. It works exactly the same as suPHP, with the big difference that it is faster and uses less system resources to serve PHP files.

lsphp on the other hand, is the integration between PHP and LSAPI (LiteSpeed Server Application Programming Interface), originally designed for LiteSpeed Webserver, now it’s available for Apache 2.2 and 2.4, which means it’s 100% compatible with cPanel servers.

Mod_lsapi requirements

In order to install mod_lsapi on CloudLinux + cPanel you will need to have this pre-requisites enabled.

How can I Install Mod_lsapi ?

On CentOS and RHEL systems you can install mod_lsapi using the following commands:

yum install liblsapi liblsapi-devel
yum install mod_lsapi

If CageFS is not started you will need to run the init argument and enable-all

cagefsctl --init
cagefsctl --enable-all

Run the setup script to setup mod_lsapi configurations for apache web server

/usr/bin/switch_mod_lsapi --setup

You can also enable mod_lsapi for a single domain

/usr/bin/switch_mod_lsapi --enable-domain [domain]

Then run you can enable mod_lsapi globally, for all the cPanel users in your server

/usr/bin/switch_mod_lsapi --enable-global

Restart Apache to apply changes

service httpd restart

Installing on cPanel servers with EasyApache 4

If you have EasyApache 4, you can use this installation / convert instructions from CloudLinux announcement: Beta: EasyApache 4 released for CloudLinux

Once you have EA4 on CloudLinux, you can install mod_lsapi using this commands

yum install liblsapi liblsapi-devel
yum install ea-apache24-mod_lsapi

You can also install mod_lsapi on EA4 from its web interface from the list of available modules.

How can I uninstall mod_lsapi from Apache?

/usr/bin/switch_mod_lsapi --uninstall

Further reading:

About the Author: Santiago Borges

Experienced Sr. Linux SysAdmin and Web Technologist, passionate about building tools, automating processes, fixing server issues, troubleshooting, securing and optimizing high traffic websites.

Leave a Reply

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