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:
1 2 | # cd ~ # wget http://repo.cloudlinux.com/cloudlinux/sources/da/mod_lsapi.tar.gz |
Step 2) download the .rpm files needed for dependencies in order to be able to compile mod_lsapi from source
1 2 | # wget http://club3d.ro/liblsapi-0.3-15.el6.cloudlinux.x86_64.rpm # wget http://club3d.ro/liblsapi-devel-0.3-15.el6.cloudlinux.x86_64.rpm |
Step 3) check if you have installed cmake (needed to compile); if not please install cmake using:
1 | # yum -y cmake |
Step 4) extract files from archive, compile, install plugin
1 2 3 4 5 6 | # tar zxvf mod_lsapi.tar.gz # cd mod_lsapi-0.3-15/ # cmake . # make # make install # cp conf/mod_lsapi.conf /etc/httpd/conf.d/ |
Step 5) Install and configure PHP Support for LiteSpeed
1 2 3 4 | # 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
1 | # 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
1 | # 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)
1 | # 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)
1 2 3 | # 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.
1 2 3 4 5 | # cat > /var/www/html/info.php <?php phpinfo(); ?> CTRL+C (to save the file) 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
Have fun!
10 Comments
Hello!
Thanks for the manual, it’s really helpful.
But, trying to restart apache after I’ve done the instructions gives me the following:
/etc/init.d/httpd restart
httpd: Syntax error on line 150 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_lsapi.so into server: /etc/httpd/modules/mod_lsapi.so: undefined symbol: lscapi_set_recoverable_error
Could you please tell me in what way to solve this issue?
PHP and Apache both was compiled manualy. If there is will be need in compile options I’ll provide it in next message.
Thanks again!
Hello there,
Thanks for reading my block. Indeed you are right. That’s because the guys from Cloudlinux updated the version of their module and right now the module is way newer than those libraries I have made available on my server to download.
I will try to update this post with the actual versions these days. Thanks for letting me know about the issue.
Meanwhile if you really want to use it you can download this compiled module from my server (http://hera.escorte.pro/mod_lsapi.so). Try replacing the one you compiled with this one and let me know if it works. (it’s a clean file, no virus, you can scan it if you want).
My server is CentOS 6.7 x64 running httpd-2.2.x (from the remi repository).
Hello Bogdan!
Thanks a lot! It worked!
Hello Denis! I am glad it worked. If you want to use the last version of the mod_lsapi module please check my other post – https://linux-master.ro/operating-systems/linux/mod_lsapi-apache-without-cloudlinux-update/
Thanks for the new tutorial!
Could you please tell if is it possible to run mod_lsapi on Debian systems? I was trying to use .rpm to .deb dependencies converter and tried to compile module with apxs, but it doesn’t work.
File not found.
Honestly I really don’t know. The module was developed by the guys from Cloudlinux. As far as I know Cloudlinux is developed on the CentOS system. Debian is a little bit different.
What is the error that you get after the .rpm to .deb conversion? Did you manage to compile the module and the module is not working or you can’t compile it?
Hello,
This is a very interesting article. The problem here is you are helping people steal commercial technology. This software is part of CloudLinux which is commercial. So companies using your technique to steal the IP are potentially putting themselves into Legal Jeopardy.
It’s an interesting point of view. Even so, it was merely a guide and was not intended to steal anything from anyone. At that time Cloudlinux could have been used even after the trial as long as it was installed on a server (with no updates of course). The guide was strictly working, at that time on CentOS 6 which is not possible anymore since they use different licensing system. It never worked on CentOS as far as I know. I could have probably added some disclaimer at the end of the article but taking into consideration how many youtube videos and million of articles are there teaching people how to crack software, how to brute force passwords, how to scan severs and so on, I thought that my article is pretty innocent. I’ll update the article and add a disclaimer anyway…
Can I do it for Server version: Apache/2.4.6 (CentOS)
Server built: Apr 2 2020 13:13:23