Wiki
 

CloudLinux PHP Selector Howto

Summary

Cloudlinux has added their support in PHP Selector to work with lsphp in LiteSpeed Web server. It leverages the same PHP Selector GUI so that user can switch between different lsphp versions in LiteSpeed Web Server without going to LiteSpeed Admin Console to build LSPHP separately.

In brief, Cloudlinux' PHP Selector, LVE Manager and CageFS need to be installed and enabled; LSWS' lsphp5 external app needs to be in NON suEXEC daemon mode with lsphp5 binary being set to a symlink that eventually points to the actual PHP binary of user's choice in CageFS.

Pre-requisites

CloudLinux:

Followings need to be installed and/or enabled:

  1. PHP Selector
  2. LVE Manager
  3. CageFS

Refer to CloudLinux document for installation details and how to enable.

LiteSpeed Web Server:

  1. CloudLinux (Admin Console ⇒ Configuration ⇒ Server ⇒ General): CageFS
  2. LSPHP5 external app runs in NON suEXEC daemon mode ONLY (Run On Start Up ⇒ Yes or No)

Installation

a. Install alt-php packages from CloudLinux repository

  yum groupinstall alt-php

b. Update CageFS and LVE Manager RPMs from CloudLinux

  yum update cagefs lvemanager --enablerepo=cloudlinux-updates-testing

As of this writing (3/15/13), the correct package version should be:

  cagefs-4.0-14
  lvemanager-0.6-1

c. Changes to /etc/pam.d/su

Make sure the following entries are appended to file /etc/pam.d/su. It should be added when CageFS is installed. Just manually add them if not.

  session    required     pam_sulve.so
  session    required     pam_lve.so      100     1

d. Verify

1. Enable cagefs for a user

  su - username 

or

  cagefsctl -e username

2. Select PHP 5.3 binary in PHP selector for illustration PHP Selector

3. In user's cagefs, /usr/local/bin/lsphp should be a symlink to php53 (since we pick 5.3 in step 2.)

  lstestc@cptest [~]# ls -l /usr/local/bin/lsphp
  lrwxrwxrwx 1 root root 22 Mar 14 19:15 /usr/local/bin/lsphp -> /etc/cl.selector/lsphp*
  lstestc@cptest [~]# ls -l /etc/cl.selector/lsphp 
  lrwxrwxrwx 1 lstestc lstestc 28 Mar 15 13:23 /etc/cl.selector/lsphp -> /opt/alt/php53/usr/bin/lsphp*
  lstestc@cptest [~]#

LiteSpeed Web Server Setting

In lsphp5 external app (Admin Console ⇒ Configuration ⇒ Server ⇒ External App ⇒ lsphp5),

Change

command => $SERVER_ROOT/fcgi-bin/lsphp5 

To

command => /usr/local/bin/lsphp

See screenshot below:

LSWS LSPHP5 setting

Notes

1. In order to use PHP Selector and custom php.ini, lsphp5 needs to be in NON suEXEC daemon mode. As explained in this blog, php.ini can not be overridden in suEXEC daemon mode.

Admin Console ⇒ Configuration ⇒ Server ⇒ External App ⇒ lsphp5

Run On Start Up => Yes or No
 
litespeed_wiki/cl_phpselector_how_to.txt · Last modified: 2013/03/18 20:38 (external edit)