PHP on CloudLinux

From ISPWiki
Jump to: navigation, search

ISPmanager 5 Business allows to set alternative PHP versions on CloudLinux in CGI and LSAPI modes. In other modes, the native PHP version is used

CGI

Version management

In order to install required PHP versions, navigate to "Web-server settings" ⇾ "PHP versions"

Applying PHP versions

CloudLinux delivers the selectorctl utility for configuration of PHP versions.

  1. If a control panel's user applies the PHP settings:
    1. the system calls selectorctl with required parameters
  2. If an administrator applies the PHP settings:
    1. changes are made into the global php.ini for the certain PHP version
    2. the system calls "cagefsctl --rebuild-alt-php-ini" to apply the changes

LSAPI

In order to set PHP as LSAPI, navigate to "Cluster settings" ⇾ "Policies" ⇾ enable "Apache  Prefork"

Configuration of PHP versions with Apache mod_lsapi is set for a "certain www-domain". Different www-domains that belong to the same user, may run different PHP versions. Those versions do not depend on the version set inphpselector.

Preliminary setup

The control panel of the cluster node performs the following operations when configuring LSAPI:

  1. Installs lsphp:
    • yum install liblsapi liblsapi-devel mod_lsapi
    • /usr/bin/switch_mod_lsapi --setup
  2. Creates names for Apache handlers:
    • creates the /etc/container/php.handler file
    • the handler is described for every alternative PHP version:
    application/x-lsphp53 /opt/alt/php53/usr/bin/lsphp
  3. Applying user settings from phpselector to every WWW-domain regardless the selected PHP version:
    • the system creates the /etc/cl.selector/symlinks.rules file:
    php.d.location = selector
    • and runs /usr/bin/selectorctl --apply-symlinks-rules

Version management

You can install required PHP versions in "Web-server settings" ⇾ "PHP versions"

Native PHP version is not used in LSAPI 

PHP 5.6 is used by the LSAPI module and cannot be deleted

Applying settings of the WWW-domain

How to enable PHP as LSAPI for a certain WWW-domain:

  1. Enable "PHP as LSAPI " for the corresponding user in the user edit form. (this option is available only for users with CageFS enabled). You can choose a default PHP version for the mode.
  2. Enable "PHP as LSAPI" on the WWW-domain edit form, and choose a PHP version

The PHP handler is activated in the VirtualHost section of the WWW-domain's configuration file:

 <FilesMatch "\.ph(p[3-5]?|tml)$">
   SetHandler application/x-lsphp53
 </FilesMatch>

Additional settings (as for PHP as Apache) are also specified in the configuration file of the WWW-domain.

Configuring alternative PHP versions

All the settings for PHP parameters and extensions made by the control panel, are also applied for PHP as LSAPI