Navigation:  Apache mod_lsapi >


Previous pageReturn to chapter overviewNext page

For all control panels - SuExecUserGroup should be present for each virtual host.

CageFS and PHP Selector will be installed by dependencies (for lsphp binaries).


Installing on cPanel servers


$ yum install liblsapi liblsapi-devel 
$ yum install mod_lsapi 


If CageFS is not initialized:


$ cagefsctl --init
$ cagefsctl --enable-all


$ /usr/bin/switch_mod_lsapi --setup
# Enable for a single domain:
$ /usr/bin/switch_mod_lsapi --enable-domain [domain]
# or globally
$  /usr/bin/switch_mod_lsapi --enable-global
$ service httpd restart


Installing on cPanel servers with EasyApache 4


How to convert EasyApache 4 for CloudLinux:


$ yum install liblsapi liblsapi-devel 

$ yum install ea-apache24-mod_lsapi 


Alternatively you can install mod_lsapi through EasyApache 4 web interface, just set "install" of ea-apache24-mod_lsapi in the list of available modules.


If CageFS is not initialized:


$ cagefsctl --init

$ cagefsctl --enable-all


$ /usr/bin/switch_mod_lsapi --setup


# Enable for a single domain:


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


# or globally


$  /usr/bin/switch_mod_lsapi --enable-global

$ service httpd restart


Note. Disable PHP-FPM for domains (if it is enabled) via cPanel's web-interface, because PHP-FPM has higher priority than mod_lsapi in httpd.conf and restart Apache for applying.


Installing on DirectAdmin servers


$ cd /usr/local/directadmin/custombuild
$ ./build update
$ ./build set php1_mode lsphp
$ ./build php n
$ ./build apache


Installing on ISPManager servers


$ yum install liblsapi liblsapi-devel

$ yum install mod_lsapi

$ /usr/bin/switch_mod_lsapi --setup


Uncomment string LoadModule lsapi_module modules/ from the file /etc/httpd/conf.d/lsapi.conf


Disable php support for needed domain (this action comment out AddHandler or AddType for VirtualHost) or for all domains.


Remove the following strings from /etc/httpd/conf/httpd.conf:


<Directory /var/www/*/data/>

php_admin_flag engine off





Add to needed (where mod_lsapi should be enabled) VirtualHost such strings:


<Directory /var/www/[username]/data/www/[domain]>

Options -ExecCGI -Includes

php_admin_flag engine on



Uncomment string AddType application/x-httpd-lsphp .php5 .php4 .php .php3 .php2 .phtml in file /etc/httpd/conf.d/mod_lsapi.conf


service httpd restart


RPM Installation


$ yum install liblsapi liblsapi-devel 
$ yum install mod_lsapi 
$ /usr/bin/switch_mod_lsapi --setup


Disable php.conf or any other PHP handler and uncomment AddType application/x-httpd-lsphp .php .php4 .php3 .phtml in /etc/httpd/conf.d/lsapi.conf and restart Apache.


$ service httpd restart


Building from source


Follow these steps to install lsphp binaries needed for mod_lsapi:


yum install cagefs lvemanager cmake gcc httpd-devel apr-devel 

yum groupinstall alt-php 

cagefsctl --init

cagefsctl --enable-all


If lsphp already exists, copy it to /usr/local/bin/lsphp (this step allows you to avoid installing alt-php).


Compile mod_lsapi:


$ yum install liblsapi liblsapi-devel 

$ cd ~
$ wget

$ tar zxvf mod_lsapi.tar.gz
$ cd mod_lsapi-0.2-7
$ cmake .
$ make
$ make install


This will:

-- Install: /usr/lib/apache/ (or to another correct httpd modules path)

-- Install: /usr/sbin/sulsphp


$ cp conf/mod_lsapi.conf /etc/httpd/conf/extra/ #(or another httpd conf directory)


If you want lsapi as global php handler, uncomment #AddType application/x-httpd-lsphp .php and disable current PHP handler. If server uses suPHP, you can enable lsphp for single hosts. Just add AddType application/x-httpd-lsphp .php5 .php4 .php .php3 .php2 .phtml to site's .htaccess.


$ install/da_cb_install


For last preparation of cagefs and php-selector should be created by script new directory /tmp/lshttpd


$ service httpd restart


Additional notes on native PHP installation


Native PHP - PHP installed and used before alt-php packages were installed. Usualy lsphp binary is not available on the servers without LiteSpeed, which means that it should be created (build from php sources with such options as usual php binary file but with LSAPI protocol built-in).


There are two ways to make native lsphp:


1) The quick one (supports all type of panels).


Native lsphp is made from alt-php56:


switch_mod_lsapi --setup

cp /opt/alt/php56/usr/bin/lsphp /usr/local/bin/


2) The slow one: to detect version of native php and build needed sources according to installed php (only for cPanel).


switch_mod_lsapi --build-native-lsphp


3) DirectAdmin has its own native lsphp builder:


/usr/local/directadmin/custombuild/build set php1_mode lsphp

/usr/local/directadmin/custombuild/build php n