====== CloudLinux PHP Selector ======
===== 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 PHP process mode needs to be in non-daemon mode (for example, Worker mode or ProcessGroup mode. Daemon mode is incompatible with PHP Selector) with lsphp5 binary being set to a symlink that eventually points to the actual PHP binary of user's choice in CageFS.
You can also check [[http://docs.cloudlinux.com/index.html?php_selector.html|Cloudlinux PHP Selector]] and [[http://docs.cloudlinux.com/index.html?litespeed_support.html|Cloudlinux PHP Selector LiteSpeed Support]] documentation.
You can still use other php configuration such as **LiteSpeed lsphp**, **cpanel easy apache php** or **plesk php** instead of PHP Selector even on a CloudLinux Box if you like, however PHP selector is a recommended way.
===== Installation =====
Followings need to be installed and/or enabled. If They have been installed and enabled, you can skip to next step for LiteSpeed configuration.
- LVE Manager
- CageFS
- PHP Selector
=== 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
=== 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 ===
Enter into user's CageFS as root
cagefsctl -e username
In user's cagefs, verify PHP version:
/usr/local/bin/lsphp -i | more
/usr/local/bin/lsphp should be a symlink to a php version specified by System Admin or user.
For example:
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 [~]#
Please also refer to CloudLinux [[http://docs.cloudlinux.com/index.html?cloudlinux_installation.html|document]] for installation details.
===== LiteSpeed Web Server Setting =====
Configure php selector in LiteSpeed Web Server setting to enable it for LSWS:
- Enable CloudLinux CageFS support under **Admin Console => Configuration => Server => General => Cloud-Linux**, and select an applicable option, e.g., ''CageFS''
- Enable **PHP suEXEC** under **Admin Console => Configuration => Using Apache Configuration File => PHP suEXEC**, set to ''Yes''
- LSPHP5 external app runs in non-daemon mode ONLY (**Run On Start Up** => ''Yes'' or ''No''). Check [[litespeed_wiki:php:which_php_setup_am_i_using#php_suexec_setups|here]] for Worker mode or ProcessGroup mode setup.
- 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:
{{:litespeed_wiki:cloudlinux:cloudlinux-php-selector.png|}}
**Notes**: In order to use PHP Selector and custom php.ini, lsphp5 needs to be in **NON**-daemon mode( for example, Worker mode or ProcessGroup mode). As explained in this [[http://blog.litespeedtech.com/2012/11/29/change-php-ini-under-php-suexec-daemon-mode-not-possible/|blog]], php.ini can not be overridden in Daemon mode.
**Configuration > Server > External App > lsphp5**
Run On Start Up => Yes or No
You can also check [[http://docs.cloudlinux.com/index.html?litespeed_support.html|Cloudlinux PHP Selector LiteSpeed Support]] documentation.