How to install mod_lsapi for apache without running CloudLinux

mod_lsapi was specially developed by CloudLinux to run as an apache module. The module is based on LiteSpeed Technologies API for PHP, Python and Ruby. Compared to the traditional mod_php module it offers excelent PHP performance, great security and support for opcode caching. More, the memory consumption is really low.

You can find a complete list of specs and details on CloudLinux Documentation:

According to CloudLinux the requirements to run mod_lsapi are as follows:

linux CentOS + CloudLinux
– Alt-PHP
– Apache compiled with SuExec support
– mod_ruid2 has to be disabled
– apache itk has to be disabled

Since I was curios to test it and I didn’t want to use on our production servers which have CloudLinux installed, I tried to install it on a regular CentOS 6.7 machine (no CloudLinux installed or running).

And I did it!

mod_lsapi: Step by step installation instructions:

Step 1) download the source code:

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:

Step 4) extract files from archive, compile, install plugin

Step 5) Install and configure PHP Support for LiteSpeed

Step 6) Create a temporary directory for lsphp

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

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)

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

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.

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

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

Have fun!

  • User Ratings (5 Votes)

About Author

I am a linux passionate and currently working as a Linux Senior System Administrator. I also am a freelancer and help people to complete different jobs. You can hire me on