Virtualmin with LSWS on centOS 7

Hello everyone

I'm currently setting up my Webserver and decided to also test LiteSpeed.
I'm using Virtualmin as my control panel. From there I can configure my virtualhost's which get saved inside the httpd.conf.
With the installation of Virtualmin alot of other programs and configurations come along. e.g. PHP, Apache, Mysql, AWStats etc.
Virtualmin sets up an fcgi suEXEC engine to use mutiple versions of PHP configured for every virtualhost at directory level. Besides the php54 and php70 that comes installed with Virtualmin I also installed php72 from Remi repro.

Now to my question/problem. I have installed a trial version of LiteSpeed following a few guides. I successfully configured LiteSpeed to read the Apache config. All the Virtualhosts show up inside the LS Webadmin.

During the insallation the wizard is asking:
You can setup a global script handler for PHP with the pre-built PHP engine
shipped with this package now. The PHP engine runs as Fast CGI which 
outperforms Apache's mod_php.
You can always replace the pre-built PHP engine with your customized PHP
Since Virtualmin already sets up a PHP engine and makes it configurable it's best to just use that, right? In the first install I answered "n" to not setup PHP for LS. But then I will get this error when trying to read a php file. (Copied from the server log viewer)
MIME type [application/x-httpd-php] for suffix '.php' does not allow serving as static file, access denied!
I think the situation here is pretty obvious. PHP just doesn't get called and so LiteSpeed prevents printing the php code or sending it for download and sends a 403. (Which is a nice feature)

Then I reinstalled LS with the default PHP setting "Y" which seems to setup an own internal PHP handler. As expected the PHP files are running now from cgi-bin inside lsws. But I think this is not the right way to do it for my usecase. Calling a wordpress also gets the following error.
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Here the phpinfo from both Virtualmin's cgi and LSWS's cgi.


So how could I integrete the PHP engine which Virtualmin setup for me inside LiteSpeed?

Thanks alot already for your help.

Greets Toby


LiteSpeed Staff
make sure you have php-litespeed rpm installed from remi repo.
then add lsphp72 handler using the lsphp binary from remi repo.
if PHP script is not served by PHP72, then add
AddType application/x-httpd-php72 php
to .htaccess.
Thanks for your answer mistwang.

I installed the php-litespeed from remi for all versions (5.6, 7.0, 7.2). And I added the /opts/remi/phpVV/root/bin/lsphp binary from all three versions to Configuration > Server > PHP > PHP Handlers.

PHP now seems to execute just fine. Also I tested suEXEC with the php-process module. The posix_getpwuid(posix_geteuid()) functions get me the correct username which is configured to execute the scripts.

The one thing that is not working yet is the ability to configure PHP from within Virtualmin.

Virtualmin/Apache root dir:
Virtualmin/Apache wp dir:
LSWS root dir:
LSWS wp dir:

You can see that in the first two links an additional php.ini from user directory gets loaded. First link runs under php7.2 the second one runs as configured under php5.6. The links running on LiteSpeed will always run on the newest php7.2 version.

This is some part out of the apache configuration which might be important.

ScriptAlias /cgi-bin/ /home/go4rent/cgi-bin/
ScriptAlias /awstats/ /home/go4rent/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/go4rent/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
AddHandler fcgid-script .php5.6
AddHandler fcgid-script .php7.0
AddHandler fcgid-script .php7.2
FCGIWrapper /home/go4rent/fcgi-bin/php7.2.fcgi .php
FCGIWrapper /home/go4rent/fcgi-bin/php5.fcgi .php5
FCGIWrapper /home/go4rent/fcgi-bin/php5.6.fcgi .php5.6
FCGIWrapper /home/go4rent/fcgi-bin/php7.0.fcgi .php7.0
FCGIWrapper /home/go4rent/fcgi-bin/php7.2.fcgi .php7.2
Is it possible for these configured options to also get applied inside LiteSpeed?
Last edited by a moderator:
Ok, thanks. Did quite some testing the last two weeks. I'm impressed with the performace boost the WP Cache brings. Trial version expired yesterday and I now can be called a happy LSWS Enterprise customer. :)

However I have yet still one thing I haven't been able to solve. Since I am using Virtualmin which handles apache configs and commands Litespeed is setup over the "Using Apache Configuration File" option.

I tried setting up the binary wrapper to control Litespeed Webserver within Virtualmin. For the option "Auto Reload On Changes" I set "Use Apache binary wrapper" of course. And the Apache binary path I've set to "/usr/sbin/httpd" which should be the correct path for centOS.

Unfortunately I don't get any success with controlling Litespeed over the Apache binary after setting up this cofiguration stated above. If I understand it correctly Litespeed is replacing the file /sbin/httpd or /usr/sbin/httpd for a shell script wrapper, which then should call Litespeed controls? I checked this Apache binary file and it still seems to be exactly the same.

How do I setup this correctly? Am I missing something?

Thanks alot.
Last edited by a moderator:
No, I cant find a file called "httpd_ls_bak" inside /usr/sbin. Only my own copy which I called "httpd.bak" since I didn't knew if Litespeed would setup a copy. But seems logical to do so.
Last edited by a moderator:
Hi mistwang.

Might I get some further assistance with that last issue I am having?
It's been quite some time since your last reply.

As I see it Litespeed isn't chaning anything regarding the apache binary.
How can I get this to work?