Installation

Navigation:  Apache mod_lsapi >

Installation

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:

 

https://www.cloudlinux.com/blog/entry/beta-easyapache-4-released-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

 

Updating mod_lsapi on cPanel servers with EasyApache 4

 

After updating ea-apache24-mod_lsapi all the domains are switched to the default handler and to turn on mod_lsapi back, it was necessary to enable lsapi handler through MultiPHP manager.

 

We noticed that it is not very convenient to enable lsapi handler through MultiPHP manager after update and automated this process.

 

So, if you update ea-apache24-mod_lsapi from stable or ea-apache24-mod_lsapi-1.1-9 or lower from beta, after the update you need to run /usr/bin/switch_mod_lsapi --setup to add lsapi handler to MultiPHP Manager.

 

After this, you will be asked to enable lsapi handler for proper PHP versions, depending on how you used mod_lsapi before (--enable-global, --enable-domain), and then restart Apache.

 

Please note that the following options were disabled for ea-apache24-mod_lsapi:

 

/usr/bin/switch_mod_lsapi --enable-domain

/usr/bin/switch_mod_lsapi --disable-domain

 

You can manage your domains with PHP version and lsapi handler from MultiPHP Manager.

 

Please note that lsapi PHP handler is only available for beta version.

 

Example 1:

 

1. ea-apache24-mod_lsapi-1.0-30 was installed and globally enabled.

 

2. The command yum update ea-apache24-mod_lsapi --enablerepo=cloudlinux-updates-testing --enablerepo=cl-ea4-testing was executed.

 

3. While switch_mod_lsapi --setup is not called, mod_lsapi will work as before.

 

4. switch_mod_lsapi --setup will return:

 

Instruction: http://docs.cloudlinux.com/index.html?apache_mod_lsapi.html

patching file apache.pm

Patch was applied correctly...

Added hook for System::upcp to hooks registry

mod_lsapi switched to turning on and off through the MultiPHP Manager(/Home/Software/MultiPHP Manager)

You are using enabled globally mod_lsapi. Do you want to enable mod_lsapi through MultiPHP Manager?

Current PHP will be switched to lsapi handler:

ea-php53 SAPI: suphp

ea-php54 SAPI: suphp

ea-php55 SAPI: cgi

ea-php56 SAPI: suphp

ea-php70 SAPI: cgi

ea-php71 SAPI: suphp

If you type no then mod_lsapi will be disabled and you can enable it again from MultiPHP Manager.

Do you want to proceed? [y/N]

 

5. If N is chosen, then mod_lsapi moves to the new type of integration with cPanel and restores files php.conf and suphp.conf. Mod_lsapi will be disabled.

 

6. If Y is chosen, then all installed versions will move to lsapi handler.

 

Setting ea-php53 to lsapi handler...

Setting ea-php54 to lsapi handler...

Setting ea-php55 to lsapi handler...

Setting ea-php56 to lsapi handler...

Setting ea-php70 to lsapi handler...

Setting ea-php71 to lsapi handler...

 

mod_lsapi_handler

 

Example 2:

 

1. ea-apache24-mod_lsapi-1.0-30 was installed and enabled only for one domain but all other domains have the same ea-php56 version.

 

2. The command yum update ea-apache24-mod_lsapi --enablerepo=cloudlinux-updates-testing --enablerepo=cl-ea4-testing was executed.

 

3. While switch_mod_lsapi --setup is not called, mod_lsapi will work as before.

 

4. switch_mod_lsapi --setup will return:

 

Instruction: http://docs.cloudlinux.com/index.html?apache_mod_lsapi.html

patching file apache.pm

Patch was applied correctly...

Added hook for System::upcp to hooks registry

Domains that handled by ea-php56:

tstdomain01.com - lsapi

tstdomain02.com - suphp

There are domains which are using mod_lsapi through --enable-domain option.

This option is deprecated for EA4 and mod_lsapi switched to turning on and off through

the MultiPHP Manager(/Home/Software/MultiPHP Manager)

Do you want to enable mod_lsapi through MultiPHP Manager for ea-php56?

Domains which are using suphp will be switched to lsapi handler too.

If you type N then mod_lsapi will remain enabled on these domains.

However, enabling mod_lsapi for new domains is now possible only through MultiPHP Manager.

Do you want to proceed? [y/N] y

Setting ea-php56 to lsapi handler...

Built /etc/apache2/conf/httpd.conf OK

Reconfiguration completed

 

5. If N is chosen, then mod_lsapi will move to the new type of integration with cPanel and will restore files php.conf and suphp.conf. Mod_lsapi still will be enabled for domains like in example tstdomain01.com throw .htaccess file.

 

6. If Y is chosen, then displayed PHP version will move to lsapi handler. According to the example, tstdomain01.com tstdomain02.com using ea-php56, will be switched to lsapi handler.

 

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/mod_lsapi.so 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

</Directory>

 

Alternatively:

 

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

</Directory>

 

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 http://repo.cloudlinux.com/cloudlinux/sources/da/mod_lsapi.tar.gz

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

 

This will:

-- Install: /usr/lib/apache/mod_lsapi.so (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 (EasyApache 3 only)

 

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