Linux SysAdmin & DevOps

Mod_lsapi - Apache install without cloudlinux

mod_lsapi - apache module based on litespeed technologies API for PHP. How to install and use it without running CloudLinux kernel.

Install and use without running CloudLinux kernel.In a previous post i was explaining how you can install mod_lsapi apache module from Cloudlinux without actually having a Cloudlinux kernel or license. This tutorial is strictly for CentOS 6.x x86_64. This post comes as an update since the guys from Cloudlinux updated their module and the necessary libraries, so at this point, you will not be able to use the fresh compiled module because of module and libraries version mismatch. The latest version of the module is 0.3-28

mod_lsapi - step by step installation guide

Step 1) Download the source code:

cd ~

Step 2) Download the .rpm files needed for dependencies in order to be able to compile mod_lsapi from source:


Step 3) Check if you have installed cmake (needed to compile); if not please install cmake using:

yum -y install cmake

Step 4) Extract files from archive, compile, install plugin:

tar zxvf mod_lsapi.tar.gz
cd mod_lsapi-0.3-15/
cmake .
make install
cp conf/mod_lsapi.conf /etc/httpd/conf.d

Step 5) Install and configure PHP Support for LiteSpeed

yum -y install php-litespeed
cp /usr/bin/lsphp /usr/local/bin/lsphp
chmod 755 /usr/bin/lsphp /usr/local/bin/lsphp
chown apache:apache /usr/bin/lsphp /usr/local/bin/lsphp

Step 6) Create a temporary directory for lsphp

mkdir /tmp/mod_lsapi; chown apache:apache /tmp/mod_lsapi

Step 7) Be sure that your apache server is running as apache/apache (user/group). You can check that by looking in /etc/httpd/conf/httpd.conf.

Step 8) If your website files are in /var/www/html let’s say and they have different owner/group than apache:apache set them accordingly

chown apache:apache /var/www/html/ -R

Step 9) Disable mod_php or other settings for php (I was using mod_php so I had to disable the module loading into apache)

mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.disabled

Step 10) Modify some settings for the lsapi module (/etc/httpd/conf.d/mod_lsapi.conf)

# uncomment AddType application/x-httpd-lsphp .php5 .php4 .php .php3 .php2 .phtml
# replace the standard settings for lsapi_user_group with lsapi_user_group apache apache
# uncomment lsapi_socket_path /tmp/mod_lsapi

Save the file when you’re done.

Step 11) Restart apache

/etc/init.d/httpd restart

In order to check if you have a running php config, check your php information in a web browser.

cat > /var/www/html/info.php <<EOF
<?php phpinfo(); ?>
chown apache:apache /var/www/html/info.php

Point your web browser to http://your_server_ip_or_hostname/info.php

You should see something like this: Server API LiteSpeed V6.8