PHP Selector is a CloudLinux component that sits on top of CageFS. It allows each user to select PHP version and module based on their needs. PHP Selector requires account to have CageFS enabled to work.
PHP Selector is compatible with the following technologies: suPHP, mod_fcgid, CGI (suexec), LiteSpeed .
It is not compatible with mod_php/DSO , including mod_ruid2 and MPM ITK .
::: tip Note PHP Selector is not supported for H-Sphere. :::
The installation of PHP Selector presumes that you already have CageFS & LVE Manager installed.
Use compatibility matrix to check if your Web Server/PHP mode is supporting PHP Selector. If not, you need a change to one of the supported models.
Installation of different versions of PHP & modules:
$ yum groupinstall alt-php
Update CageFS & LVE Manager with support for PHP Alternatives:
$ yum update cagefs lvemanager
cPanel/WHM : Make sure 'Select PHP version' is enabled in Feature Manager .
IMPORTANT : Please, do not use settings like SuPHP_ConfigPath, PHPRC, PHP_INI_SCAN_DIR . Do not redefine path to php.ini and ini-files for PHP modules. Doing that can break PHP Selector functionality.
For example, alternative php5.2 versions should load /opt/alt/php52/etc/php.ini file and scan /opt/alt/php52/etc/php.d directory for modules:
Configuration File (php.ini) Path /opt/alt/php52/etc
Loaded Configuration File /opt/alt/php52/etc/php.ini
Scan this dir for additional .ini files /opt/alt/php52/etc/php.d
additional .ini files parsed /opt/alt/php52/etc/php.d/alt_php.ini
Those are default locations for alt-php .
If you need custom PHP settings per user, please change them via "Edit PHP settings" feature of PHP Selector .
If a list of default modules is absent on the server in the /etc/cl.selector/defaults.cfg file for some alt-PHP version and there is nd_mysqli extension in this version, then on installation/update of the LVE Manager, the mysqli extension will be disabled and nd_mysqli extension will be enabled automatically.
- If nd_mysqli module is absent or a list of enabled modules is available, then they won't be changed automatically.
- If alt-PHP is not installed on LVE Manager installation/update, then they won’t be changed automatically.
To change the modules status (enabled/disabled) manually, run the following command in a console:
# /usr/sbin/cloudlinux-selector make-defaults-config --json --interpreter=php
Update
To update PHP Selector, run the following command:
yum groupupdate alt-php
This command allows to install newly released versions in PHP Selector.
::: tip Note LiteSpeed detects CloudLinux OS and applies all settings out-of-the-box. :::
If the settings were not applied, you can use the following steps to set up LiteSpeed to use PHP Selector.
How to set up LiteSpeed version lower than 5.3 to use PHP Selector
To enable PHP Selector with LiteSpeed Web Server follow PHP Selector installation guide , and then adjust following settings in LiteSpeed :
- CloudLinux (Admin Console --> Configuration --> Server --> General): CageFS
- Enable SuExec: Server--> General --> PHP SuEXEC --> Yes
- Go to External App tab, the new lsphp_selector is here.
[Note that you can select any other application or create a custom one.]
- The Command line should be /var/www/cgi-bin/cgi_wrapper/cloudlinux_wrapper on Plesk . For other control panels, Command line should be /usr/local/bin/lsphp .
Run On Start Up line must contain Yes or No .
For Plesk :
For other control panels:
- Go to Script Handler tab. For required suffixes change the Handler Name to lsphp_selector .
Additional settings for LiteSpeed version 5.3 +
Go to Server --> PHP tab. Click Edit in the PHP Handler Defaults section. We recommend to set up the following settings:
- Set Yes in the Run On Startup
- Make sure to set Max Idle Time
::: tip Note In order to use PHP Selector and custom php.ini, lsphp5 needs to be in SuEXEC non-daemon mode. :::
::: tip Note Some PHP configurations require more memory for SuExec to work properly. If you are getting error 500 after switching suEXEC to non-daemon mode, try to increase Memory Soft Limit and Memory Hard Limit for external App to at least 650/800M. :::
::: tip Note If you have LiteSpeed installed not in standard location path, please create a symlink: 'ln -s /path/to/custom/lsws /usr/local/lsws' then run 'cagefsctl --setup-cl-selector'. :::
As of July 2013, PHP Selector support for ISPmanager is limited to command line utilities. You should still be able to use it.
As always, PHP Selector requires CGI, FCGI or suPHP to work.
You will need to do following modifications:
Create new file /usr/local/bin/php-cgi-etc:
#!/bin/bash
/usr/bin/php-cgi -c /etc/php.ini "$@"
$ chmod +x /usr/local/bin/php-cgi-etc
Add a line:
path phpcgibinary /usr/local/bin/php-cgi-etc
Make sure there is no other lines with path phpcgibinary defined in the file.
Restart ISPmanager :
$ killall ispmgr
After that FCGID wrappers (/var/www/[USER]/data/php-bin/php) for new users will be like this:
#!/usr/local/bin/php-cgi-etc
You might need to edit/modify wrappers for existing users if you want them to be able to use PHP Selector . You can leave them as is for users that don't need such functionality.
- Setting default version and modules
- Individual PHP.ini files
- Substitute global php.ini for individual customer
- Managing interpreter version
- Including PHP Selector only with some packages (cPanel)
- PHP Extensions
- FFmpeg
- Native PHP Configuration
Administrator can set default interpreter version and extensions for all users. All file operations are actually done by CageFS. CageFS takes settings from /etc/cl.selector/defaults.cfg. Currently the /etc/cl.selector/defaults.cfg is created and handled by CloudLinux PHP Selector scripts. It has the following format:
[global]
selector=enabled
[versions]
php=5.4
[php5.4]
modules=json,phar
[php5.3]
modules=json,zip,fileinfo
For each customer, inside CageFS, file alt_php.ini is located in /etc/cl.php.d/alt-phpXX (XX - version of PHP, like 52 or 53). The file contains PHP extension settings and extension directives selected by customer. This file exists for each customer, for each PHP version.
Note, that this is 'local' to CageFS, and different users will have different files. The file is not visible in /etc/cl.php.d outside CageFS. If you would like to view that file, use:
# cagefsctl -e USERNAME
to enter into CageFS for that user. Then type: exit ; to exit from CageFS
This file has to be updated using cagefsctl --rebuild-alt-php-ini after updating alt-php RPMs
Admin can change individual settings for PHP extensions by changing that extension's ini file, like editing /opt/alt/php54/etc/php.d.all/eaccelerator.ini and then running:
cagefsctl --rebuild-alt-php-ini
Sometimes you might want to have a single customer with a different php.ini, than the rest of your customers.
To do that, you will use custom.etc directory functionality
- Move default php.ini into /etc directory and create a symlink to it:
$ mv /usr/local/lib/php.ini /etc/php.ini
$ ln -fs /etc/php.ini /usr/local/lib/php.ini
- Change path to php.ini in /etc/cl.selector/native.conf file to:
php.ini=/etc/php.ini
- For each user that needs custom file, create directory /etc/cagefs/custom.etc/USER_NAME/php.ini .
For example if you want to create custom for USER1 and USER2 you would create files:
/etc/cagefs/custom.etc/USER1/php.ini
/etc/cagefs/custom.etc/USER2/php.ini
Create such files for each user that should have custom file.
- Execute:
$ cagefsctl --force-update
::: tip Notes
-
Make sure that
php.iniload path is set to/etc/php.ini -
Users will be able to override settings of those php.ini files (global or custom) via PHP Selector. If you want to prevent that, you should disable PHP Selector feature.
-
Even if PHP Selector is disabled, user can override PHP settings by using
ini_set() phpfunction in PHP script, or byphp -ccommand line option. -
If you modify anything in
/etc/cagefs/custom.etcdirectory, you should execute:
$ cagefsctl --update-etc
in order to apply changes to CageFS for all users.
OR
$ cagefsctl --update-etc user1 user2
to apply changes to CageFS for specific users.
:::
Managing interpreter versions is done by means of manipulating a set of symbolic links that point to different versions of interpreter binaries. For example, if default PHP binary is /usr/local/bin/php :
- First we move the default binary inside CageFS to
/usr/share/cagefs-skeleton/usr/selector, and make /usr/local/bin/php a symlink pointing to /etc/cl.selector/php . This operation is done as part of CageFS deployment. - Next suppose we have additional PHP version, say 7.2.5. The information about all additional interpreter binaries and paths for them is kept in /etc/cl.selector/selector.conf . This config file is updated by RPM package manager each time alternative PHP package is added, removed or updated
-
/usr/bin/selectorctl --list --interpreter=phpwill get us list of all available PHP interpreter versions out of /etc/cl.selector/selector.conf file . Next we want to know which PHP version is active for a given user (to supply a selected option in options list). We type: -
/usr/bin/selectorctl --user USERNAME --interpreter=php --user-currentwill retrieve PHP version set for a particular user. The script gets the path from/var/cagefs/LAST_TWO_DIGITS_OF_UID/USERNAME/etc/cl.selector/phpsymlink, compares it with contents of /etc/cl.selector/selector.conf file and if path is valid, prints out the current interpreter version. -
/usr/bin/selectorctl --user USERNAME --interpreter=php --set-user-current=7.2sets the current PHP version for particular user by creating symlink in/var/cagefs/LAST_TWO_DIGITS_OF_UID/USERNAME/etc/cl.selectordirectory. All old symlinks are removed, and new symlinks are set.
cPanel has a ' Feature Manager ' in WHM that allows you to disable PHP Selector for some of the packages that you offer.
In reality it only disables the icon in cPanel interface. Yet, in most cases it should be enough in shared hosting settings.
You can find more info on ' Feature Manager ' here: http://docs.cpanel.net/twiki/bin/view/11_30/WHMDocs/FeatureManager
Once PHP Selector is enabled, you can find it in the Feature Manager . Disabling it in Feature Manager , will remove the icon for users that are using that particular 'Feature List'
Configuring Alt-PHP modules loading
CloudLinux PHP Selector and Alt-PHP can be used in conjunction with Plesk PHP Selector and cPanel MultiPHP . To be compatible, CloudLinux PHP Selector works as follows: modules that are selected in CloudLinux PHP Selector are loaded for Alt-PHP version selected in CloudLinux PHP Selector only. For the rest Alt-PHP versions default module set is loaded ( /opt/alt/phpXX/etc/php.d/default.ini ) . Described above is default behavior.
::: tip Note If system default PHP version selected in cPanel MultiPHP Manager is not ea-php, then default module set is loaded for all Alt-PHP versions by default (/opt/alt/phpXX/etc/php.d/default.ini).
When "php.d.location = selector" option is in effect, modules selected via PHP Selector will be loaded for all alt-php versions. :::
This behavior is implemented in CageFS-6.1-10 and later.
In LVE Manager 1.0-9.40+ this behavior can be modified so that modules selected in CloudLinux PHP Selector would be loaded for all Alt-PHP versions (with CageFS enabled), which can be quite useful if you use ‘ per directory ’ or ‘ per domain ’ Alt-PHP configuration and want to select modules using CloudLinux PHP Selector .
To modify it, create a file /etc/cl.selector/symlinks.rules (read-only for regular users) with the following content: php.d.location = selector
And run the command to apply changes:
/usr/bin/selectorctl --apply-symlinks-rules
- Delete /etc/cl.selector/symlinks.rules file.
- Alternatively remove php.d.location option from the file.
- Alternatively set default value for php.d.location option.
And run the command to apply changes:
/usr/bin/selectorctl --apply-symlinks-rules
Due to possible patent issues CloudLinux does not provide FFmpeg libraries ( https://ffmpeg.org/legal.html ). We highly recommend researching if you can legally install FFmpeg extension on your server. This might differ based on where you and your servers are located. More information can be found on the link: https://ffmpeg.org/legal.html
For your convenience we provide FFMPEG PHP binding. For them to work, you need to install FFmpeg package from the “ Nux Dextop ” repository following the instructions.
Once FFmpeg is installed you can install PHP bindings, by running:
yum install alt-php*ffmpeg
Enable PHP-FFmpeg extension via PHP Selector :
selectorctl --enable-extensions=ffmpeg --user USERNAME --version X.Y
PHP Selector requires access to the native PHP version for proper work. It is specified in the file /etc/cl.selector/native.conf of the following content (example):
php=/usr/bin/php-cgi
php-cli=/usr/bin/php
php.ini=/etc/php.ini
The file is created when installing CageFS on the servers with cPanel, Plesk, DA, Interworx and ISP Manager , if it is missing. On all other servers the file is not being created at all.
That is why, if the file is not created automatically, then it must be created manually and correct paths must be written to its directives.
Access permission 644 must be set:
chmod 0644 /etc/cl.selector/native.conf
| /usr/bin/cl-selector | Tool is used to select version of PHP interpreter inside CageFS. Note. The command is obsolete, please use selectorctl instead. |
| /usr/bin/alt-php-mysql-reconfigure.py | Reconfigures alt-php extensions to use correct MySQL library, based on the one installed in the system. |
selectorctl is a new tool that replaces cl-selector (which is deprecated and should not be used anymore) and piniset . It is available starting with CageFS 5.1.3 .
All new features will be implemented as part of selectorctl .
Common Options
| --interpreter (-i) : | chooses the interpreter to work with. Currently only PHP is supported. If omitted, --interpreter=php is implied. |
| --version (-v) : | specifies alternatives version to work with |
| --user (-u) : | specifies user to take action upon. |
| --show-native-version (-V) : | prints the version of native interpreter |
Global Options
The global options modify settings in /etc/cl.selector/defaults.cfg file.
| --list (-l) : | lists all available alternatives for an interpreter. For instance on server with Alt-PHP installed, it produces the following output. Columns are: short alternative version, full alternative version and path to php-cgi binary. |
| $ selectorctl --list 5.2 5.2.17 /opt/alt/php52/usr/bin/php-cgi 5.3 5.3.28 /opt/alt/php53/usr/bin/php-cgi 5.4 5.4.23 /opt/alt/php54/usr/bin/php-cgi 5.5 5.5.7 /opt/alt/php55/usr/bin/php-cgi |
|
| --summary (-S) : | prints alternatives state summary. Output format: alternative version, state ('e' for 'enabled', '-' otherwise), chosen as default one or not ('d' for 'default', '-' otherwise). For example: |
| $ selectorctl --summary 5.2 e - 5.3 e - 5.4 e - 5.5 e - native e d |
|
if used with --show-native-version displays version for native interpreter: |
|
| $ selectorctl --summary --show-native-version 5.2 e - 5.3 e - 5.4 e - 5.5 e - native(5.3) e d |
|
| --current (-C) : | prints currently globally selected default version (it is stored in /etc/cl.selector/defaults.cfg file): |
| $ selectorctl --current native native /usr/bin/php |
|
If used with --show-native-version , native interpreter version is displayed as well: |
|
| --current --show-native-version native(5.3) native(5.3.19) /usr/bin/php |
|
| --set-current (-B): | sets specified version as globally default one (in /etc/cl.selector/defaults.cfg file). For example, to set current default version of PHP to 5.4, use: |
| $ selectorctl --set-current=5.4 | |
| --disable-alternative (-N): | adds state=disabled option to alternative section. With it a corresponding alternative gets removed from user alternatives selection list. For instance to disable PHP 5.2, run: |
| $ selectorctl --disable-alternative=5.2 | |
| --enable-alternative (-Y): | Enables alternative version, removes state=disabled option, if present, from alternative section. For example to enable PHP 5.2: |
| $ selectorctl --enable-alternative=5.2 | |
| --enable-extensions (-E): | enables extensions for particular PHP version by adding comma-separated list of extensions of modules for alternative in /etc/cl.selector/defaults.cfg . Requires --version option. For example: |
| $ selectorctl --enable-extensions=pdo,phar --version=5.2 | |
| --disable-extensions (-D): | removes extensions for a particular PHP version. Comma-separated list of extensions will be removed from /etc/cl.selector/defaults.cfg . Requires --version . Example: |
| $ selectorctl --disable-extensions=pdo,phar --version=5.2 | |
| --replace-extensions (-R): | replaces all extensions for particular PHP version to the list of comma separated extensions. Requires --version option . Example: |
| $ selectorctl --replace-extensions=pdo,phar --version=5.2 | |
| --list-extensions (-G): | lists extensions for an alternative for a particular version. Requires --version . Example: |
| $ selectorctl --list-extensions --version=5.3 ~ xml - xmlreader - xmlrpc - xmlwriter - xrange + xsl |
|
| Plus sign (+) stands for 'enabled', minus (–) for 'disabled', tilde (~) means compiled into interpreter. Enabled and disabled state relates to presence in /etc/cl.selector/defaults.cfg file. |
End User Options
All end-user settings are contained in individual user's alt_php.ini files and controlled using selectorctl command.
| --user-summary (-s): | prints user alternatives state summary. Example: |
| $ selectorctl --user-summary --user=user1 5.2 e - - 5.3 e - - 5.4 e - - 5.5 e - - native e d s |
|
Columns are: alternative version, state ('e' for 'enabled', '-' otherwise), chosen as default one or not('d' for 'default', '-' otherwise), selected as user default one or not ('s' for 'selected', '-' otherwise). If used with --show-native-version , version for native interpreter is shown in parenthesis: |
|
| $ selectorctl --user-summary --user=user1 --show-native-version 5.2 e - - 5.3 e - - 5.4 e - - 5.5 e - - native(5.3) e d s |
|
--user option is required. |
|
| --current (-c): | prints currently globally selected default version (in /etc/cl.selector/defaults.cfg file): |
| $ selectorctl --current 5.3 5.3.28 /opt/alt/php53/usr/bin/php-cgi |
|
If used with --show-native-version to display native version: |
|
| $ selectorctl --user-current --user=user1 5.3 5.3.28 /opt/alt/php53/usr/bin/php-cgi |
|
--user option is required. |
|
| --set-user-current (-b): | sets specified version as the one to use for this end user: |
| $ selectorctl --set-user-current=5.4 --user=user1 | |
| changes user symlinks for the PHP interpreter to point to alternative 5.4. | |
| --user option is required. | |
| --enable-user-extensions (-e): | Enables comma-separated list of extensions for the user user. Information is saved to alt_php.ini file. Requires --version and --user options. |
| $ selectorctl --enable-user-extensions=pdo,phar --version=5.2 --user=user1 | |
| --disable-user-extensions (-d): | Disables extensions provided as comma-separated list. Requires --version and --user options. |
| $ selectorctl --disable-user-extensions=pdo,phar --version=5.2 --user=user1 | |
| --replace-user-extensions (-r): | Replaces extensions with a provided comma-separated list of extensions Requires --version and --user options: |
| $ selectorctl --replace-user-extensions=pdo,phar --version=5.2 --user=user1 | |
| --reset-user-extensions (-t): | Resets extensions for end user to default list of extensions as defined in default.cfg . Requires --version and --user options. |
| $ selectorctl --reset-user-extensions --version=5.2 --user=user1 | |
| --list-user-extensions (-g): | lists enabled user extensions for an alternative. Requires --version and --user options. |
| $ selectorctl --list-user-extensions --version=5.3 --user=user1 xml xmlreader xmlrpc |
|
if --all option present, command will list all alternatives extensions marked enabled or disabled for given user. For example: |
|
| $ selectorctl --list-user-extensions --version=5.3 --user=user1 --all - xmlreader - xmlrpc - xmlwriter - xrange + xsl |
|
| Plus sign (+) stands for 'enabled', minus (–) stands for 'disabled'. Enabled and disabled state relates to presence or absence of corresponding extensions in user alt_php.ini file. | |
| --add-options (-k): | adds options (as in php.ini ) to user alt_php.ini file. For example: |
| $ selectorctl --add-options=log_errors:on,display_errors:on --version=5.2 --user=user1 | |
adds log_error and display_errors options with values 'on' to user alt_php.ini file overwriting default values for a user. Requires --version and --user options. |
|
| --replace-options (-m): | replaces all options in user alt_php.ini file with specified ones. Requires --version and --user options. |
| $ selectorctl --replace-options=log_errors:on,display_errors:on --version=5.2 --user=user1 | |
| --delete-options (-x): | removes custom options from user alt_php.ini file. Requires --version and --user options. |
| $ selectorctl --delete-options=log_errors,display_errors --version=5.2 --user=user1 | |
| --print-options (-P): | print options from /etc/cl.selector/php.conf file with default values or ones overwritten in user's alt_php.ini file. |
| $ selectorctl --print-options --version=5.2 --user=user1 TITLE:allow_url_fopen DEFAULT:On COMMENT:Allows PHP file functions to retrieve data from remote locations over FTP or HTTP. This option is a great security risk, thus do not turn it on without necessity. TYPE:bool ... |
|
Requires --user option. --version option is optional. When --version is omitted, options for current selected version will be printed. By default outputs as plain test. If --json , --csv , --perl is specified, outputs data in corresponding format. For example, with --perl option, the output is perl hash structure that can be evaluated. |
|
| --reset-options (-z): | removes custom options from alt_php.ini files for ALL users and versions. Backup files in home folders are cleared. |
| $ selectorctl --reset-options | |
The ranges of affected customers or versions can be narrowed with --version or --user options : |
|
| $ selectorctl --reset-options --user=user1,user2 --version=5.3,5.4 | |
| --list-users (-L): | list users that use particular version of interpreter, specified with --version option. For example, to see all users that use PHP version 5.3: |
| $ selectorctl --list-users --version=5.3 | |
| --change-to-version (-T): | changes all (or particular user) from one interpreter version to another. |
| $ selectorctl --change-to-version=5.2 --version=5.3 |
Additional Options
| --base64 (-Q) | Sometimes PHP options values can contain commas and other symbols that break command line formatting. In such a case convert a key:value pair into base64 and pass it as value for option-related arguments. For example, to add disable_functions=exec,popen,system and display_errors=on to user options, do the following: |
| $ selectorctl --add-options=`echo disable_functions:exec,popen,system | |
Option -w 0 of base64 executable stands for 'disable wrapping of lines' . Without it base64 output will break the command. |
|
| --quiet | makes selectorctl continue when it encounter option not found in php.conf . Without it selectorctl exits with error. |
This is the list of commands that we use to integrate PHP Selector with control panels. If you need to integrate PHP Selector with a custom control panel, you might find all the commands here:
PHP summary:
Command:
/usr/bin/selectorctl --summary
4.4 e -
5.1 e -
5.2 e -
5.3 e -
5.4 e -
5.5 e -
5.6 e -
7.0 e -
7.1 e -
native e d
Command:
/usr/bin/selectorctl --summary --show-native-version
Result:
4.4 e -
5.1 e -
5.2 e -
5.3 e -
5.4 e -
5.5 e -
5.6 e -
7.0 e -
7.1 e -
native(5.6) e d
The first column: PHP version
The second column: enabled or not ( e - enabled)
The third column: if selected as default ( d - default)
Set default version:
/usr/bin/selectorctl --set-current=_VERSION_
Disable version:
/usr/bin/selectorctl --disable-alternative=_VERSION_
Enable version:
/usr/bin/selectorctl --enable-alternative=_VERSION_
List Extensions for a version:
/usr/bin/selectorctl --list-extensions --version=5.6
Result:
- apc
- bcmath
- big_int
- bitset
- bloomy
~ bz2
- bz2_filter
~ calendar
- coin_acceptor
- crack
~ ctype
+ curl
+: enabled
~: included in php binary (cannot be disabled)
-: disabled
Select Default Extensions (enable comma-separated list of extensions globally for a version):
/usr/bin/selectorctl --version=5.6 --enable-extensions=pdo,json,mysql
Deselect Default Extensions (disable comma-separated list of extensions globally for a version):
/usr/bin/selectorctl --version=5.6 --disable-extensions=pdo,json,mysql
Replace extensions with comma-separated list of extensions for a version globally:
/usr/bin/selectorctl --version=5.6 --replace-extensions=pdo,json,mysql
Select PHP version for a user:
/usr/bin/selectorctl --set-user-current=_VERSION_ --user=_USER_
List Enabled extensions for a user:
/usr/bin/selectorctl --list-user-extensions --user=_USER_ --version=_VERSION_
Enable comma-separated list of extensions for a user:
/usr/bin/selectorctl --enable-user-extensions=pdo,json,mysql --user=_USER_ --version=_VERSION_
Reset user’s extensions to defaults:
/usr/bin/selectorctl --reset-user-extensions --user=_USER_ --version=_VERSION_
Replace user extensions with comma-separated list of extensions:
/usr/bin/selectorctl --replace-user-extensions=EXT_LIST --user=_USER_ --version=_VERSION_
EXT_LIST a is comma separated list of PHP extensions (for example: pdo,json,mysql )
List available options for php.ini editing:
/usr/bin/selectorctl --print-options --user=_USER_ --version=_VERSION_ [--json]
List available options for php.ini editing (print safe strings):
/usr/bin/selectorctl --print-options-safe --user=_USER_ --version=_VERSION_ [--json]
Set php.ini options for end user:
/usr/bin/selectorctl --user=_USER_ --version=_VERSION_ --replace-options=_OPTIONS_ --base64 [--json]
Here is an example of how you can generate OPTIONS in base64 format:
OPTIONS=`echo disable_functions:exec,syslog|base64 -w 0`,`echo display_errors:off|base64 -w 0`,`echo post_max_size:128M|base64 -w 0`
echo $OPTIONS
It is not possible to remove PHP Selector from the system completely as it is an essential part of LVE Manager and CageFS packages. However, you can make PHP Selector unavailable for cPanel and Plesk users.
To do so, go to LVE Manager → PHP Selector and check Disabled as PHP Selector status. Doing so allows you to disable web-interface of the PHP Selector in the user interface but does not reset custom settings (choosing a version of PHP and modules).
To disable PHP Selector and make it has no effect on a PHP version on the sites, run the following command:
- this command resets PHP versions to Native:
cagefsctl --cl-selector-reset-versions
- this command resets PHP modules to Default:
cagefsctl --cl-selector-reset-modules
::: danger These commands can affect PHP version of your clients’ web sites. Use them with caution as improper usage might cause your clients’ web sites down. :::
Once PHP Selector is installed, you will see the Selector tab in the LVE Manager.
PHP Selector lets you select default PHP version, as well as modules that will be available to user out of the box.
Inside cPanel , User will be able to change PHP version they would have:
as well as extensions that they want to use:
and php.ini settings
All changes are saved automatically.
[Requires LVE Manager 0.6+]
PHP Selector allows customer to edit php.ini settings. Admin has a full control over which settings can be modified.
To allow settings to be modifiable, it has to be whitelisted in /etc/cl.selector/php.conf .
Here are some of the examples of allowed directives:
Directive = safe_mode
Default = Off
Type = bool
Remark = <5.4.0
Comment = Enables PHP safe mode. This mode puts a number of restrictions on scripts (say, access to file system) mainly for security reasons.
Directive = safe_mode_include_dir
Type = value
Remark = <5.4.0
Comment = If PHP is in the safe mode and a script tries to access some files, files from this directory will bypass security (UID/GID) checks. The directory must also be in include_path. For example: /dir/inc
| Directive | php.ini setting |
| Default | Default value |
| Type | bool, value (any text), list |
| Range | list of values for list Type |
| Comment | explanation of the setting to display in UI |
Default values, that are shown in PHP Selector web interface, are taken from '/opt/alt/phpXX/usr/bin/php -i' runtime values, if directive is not there, it will use ' default ' value that was set in php.conf . So, if you wish to change default value of any option for "alternative" php version, please modify /opt/alt/phpXX/etc/php.ini files (where XX = 55, 54, 53, etc according to php version).
Admin can modify the settings using selectorctl command.
Users can use web interface to modify php.ini settings:
The following files and directories are created inside CageFS for each customer:
/etc/cl.selector - PHP binaries symbolic links.
/usr/selector/php - Native PHP binaries.
/etc/cl.php.d/alt-php* - Links to enabled modules.
/home/user/.cl.selector/alt_phpXX.cfg - Config file for custom PHP options.
like:
/etc/cl.php.d/alt-php54/fileinfo.ini - /opt/alt/php54/etc/php.d.all/fileinfo.ini
Sometimes you might want to compile your own PHP extension for your users to use. In most cases, it is better to contact our support by sending us a support ticket . We will try to provide such extension for you via regular updates within 5-7 days.
If you have decided that you want to build it on your own, you would need to build it for each and every supported version of PHP that you have installed. The module installation process is a bit different from standard - you would need to use the version of phpize and php-config binaries that come with particular Alt-PHP version.
The full process for PHP 5.X and 7.X looks as follows:
-
Download and unpack extension, cd into it's directory.
-
Execute our version of phpize if necessary:
/opt/alt/phpXX/usr/bin/phpize
- Execute configure with our binary:
./configure --with-php-config=/opt/alt/phpXX/usr/bin/php-config
- Make the .so file:
make
- Copy it to the modules directory (on 32-bit server, use usr/lib/php/modules ).
cp -rp modules/*.so /opt/alt/phpXX/usr/lib64/php/modules/
-
Add ini file for module to
/opt/alt/phpXX/etc/php.d.all. -
Register new Alt-PHP version with:
$ cagefsctl --setup-cl-selector
To add your own PHP version in PHP Selector :
- Create directory in (like: /opt/alt/php51), and mimic directory structure inside to be similar to the one of PHP versions bundled by CloudLinux .
- Put all the ini files for all the modules into /opt/alt/php51/etc/php.d.all
- Create a symbolic link /opt/alt/php51/etc/php.d -> /etc/cl.php.d/alt-php51
Place all such files into /opt/alt/php51/usr/lib/php/modules
Add an absolute path to PHP binaries into /etc/cl.selector/selector.conf using the following format:
php 5.1 5.1.2 /opt/alt/php51/usr/bin/php-cgi
php-cli 5.1 5.1.2 /opt/alt/php51/usr/bin/php
php-fpm 5.1 5.1.2 /opt/alt/php51/usr/sbin/php-fpm
^ ^ ^ ^----- absolute path
| | |---------------------- real version
| | -------------------------- version to display
|--------------------------------- binary to 'substitute'
Execute:
cagefsctl --setup-cl-selector
The new PHP version must be available now for selection in PHP Selector .
[ LVE Manager 0.5-63 or higher]
PHP Selector provides an easy way to figure out which versions are available and selected for end user from the command line. You can get this information by running:
$ selectorctl --interpreter=php --user-summary --user=USERNAME
The output:
5.2 e - -
5.3 e - s
5.4 e - -
5.5 e - -
native e d -
The first column defines the PHP version. Native means native PHP version, like the one installed by cPanel with EasyApache.
The second column will contain either e or -. If e is present, it means that given version is enabled, and can be selected by the end user.
The third column can have values d or -. If d is present, that version is considered a 'default' version. Only one PHP version will have d indicator.
The fourth column can have values s or -. If s is present, that is the selected version, currently being used by the end user. Only one PHP version will have s indicator.
In case a user is not inside CageFS, and as such doesn't use PHP Selector , you will see the following error message:
ERROR:User USERNAME not in CageFS
[LVE Manager 2.0-11.1 or higher]
PHP Selector can now be used with CageFS turned off (in case when there is only one user account on the server).
To install run:
yum groupinstall alt-phpyum install cagefs lvemanager
(no need to initialize or turn on CageFS)
selectorctl --setup-without-cagefs USER
( USER - the name of a user who is using selector. If not specified, the first available cPanel account username will be used).
When executing --setup-without-cagefs , the following actions are performed:
-
Creating symlinks to the user modules and options for each Alt-PHP version:
/opt/alt/php55/link/conf/alt_php.ini -> /home/USER/.cl.selector/alt_php55.ini -
In user home directory creating:
.cl.selector/
“Backup” settings files (selected version, modules, options):
.cl.selector/defaults.cfg
.cl.selector/alt_php44.cfg
Symlinks to the selected version:
.cl.selector/lsphp -> /opt/alt/php44/usr/bin/lsphp
.cl.selector/php.ini -> /opt/alt/php44/etc/php.ini
.cl.selector/php-cli -> /opt/alt/php44/usr/bin/php
.cl.selector/php -> /opt/alt/php44/usr/bin/php-cgi
Additional symlinks for environment variable $PATH (search path) in the file ~/.bashrc :
.cl.selector/selector.path/
.cl.selector/selector.path/php-cgi -> ../php
.cl.selector/selector.path/php -> ../php-cli
Generated ini files with selected modules and options for each version:
.cl.selector/alt_php44.ini
.cl.selector/alt_php51.ini
.cl.selector/alt_php52.ini
.cl.selector/alt_php53.ini
.cl.selector/alt_php54.ini
.cl.selector/alt_php55.ini
.cl.selector/alt_php56.ini
.cl.selector/alt_php70.ini
.cl.selector/alt_php71.ini
Symlinks above are being created according to the settings in ~/.cl.selector/defaults.cfg and ~/.cl.selector/alt_php44.cfg files (44 - corresponding PHP version), which are storing PHP Selector settings for the user. These files are usually taken from user home directory backup or when migrating account from another server. Thus, when migrating account from server to server, PHP Selector settings are saved.
If no PHP Selector settings backup files are found when running selectorctl --setup-without-cagefs , then default settings from /etc/cl.selector/defaults.cfg global file are applied (as in selector normal mode). If the file is absent, then native PHP version will be selected for the user.
- The following line: PATH=$HOME/.cl.selector/selector.path:$HOME/.cl.selector:$PATH
is being added to the user file ~/.bashrc
Apache PHP handlers settings are not changed.
-
Also
selectorctl --setup-without-cagefscommand does the following:- Turns off link traversal protection (linksafe);
- Turns off cagefs service.
To get back to the selector normal mode (“with CageFS”) run:
selectorctl --revert-to-cagefs
(CageFS should be initialized by using “cagefsctl --init” command before running the command above)
This command removes symlinks:
/opt/alt/php55/link/conf/alt_php.ini -> /home/USER/.cl.selector/alt_php55.ini,
turns on link traversal protection (linksafe) and cagefs service.
[CageFS 6.0-33 or higher, LVE Manager 2.0-11.2 or higher]
There is /etc/cl.selector/global_php.ini file, where you can specify values of PHP options that should be applied for all Alt-PHP versions that are installed on a server. These settings will also be automatically applied to the new Alt-PHP versions that will be installed later.
Example:
# cat /etc/cl.selector/global_php.ini
[Global PHP Settings]
date.timezone = Europe/Warsaw
error_log = error_log
memory_limit = 192M
Sections are ignored. Only name of an option and a value have meaning.
When an option is absent in /etc/cl.selector/global_php.ini file, than it is not changed (applied) to php.ini for Alt-PHP versions.
date.timezone and error_log options are handled differently than the others. When these options are not in /etc/cl.selector/global_php.ini file, than values for the options will be taken from "native" php.ini file. And when the option is in php.ini for some Alt-PHP version already (and its value is not empty), than value from /etc/cl.selector/global_php.ini will be NOT applied.
[CageFS version 6.1.5-1 or later]
The behavior above is changed for cPanel servers with EasyApache 4. The /usr/local/lib/php.ini file is removed for new installations of cPanel v80 and later.
- When
/usr/local/lib/php.inifile exists,error_loganddate.timezoneoptions will be taken from thatphp.inifile. - When
/usr/local/lib/php.inifile does not exist,error_loganddate.timezoneoptions will be taken from thephp.inifile for system default PHP version selected in MultiPHP Manager.
This functionality works when the system default PHP version is ea-php only. When the system default PHP version is alt-php, error_log and date.timezone directives will be NOT taken from that php.ini file.
To confirm changes (not affecting "date.timezone" and "error_log" options) please run:
/usr/sbin/cagefsctl --setup-cl-selector
To confirm changes (including "date.timezone" and "error_log" options) please run:
/usr/bin/selectorctl --apply-global-php-ini
/usr/sbin/cagefsctl --apply-global-php-ini
If you don't want to change error_log , but want to change date.timezone , you can execute:
selectorctl --apply-global-php-ini date.timezone
Similarly, command selectorctl --apply-global-php-ini error_log applies error_log and all other options specified in /etc/cl.selector/global_php.ini file, except date.timezone .
So, you can specify 0, 1 or 2 parameters from the list: error_log, date.timezone .
Using --apply-global-php-ini without arguments applies all global PHP options including two above.
Example:
selectorctl --apply-global-php-ini error_log
selectorctl --apply-global-php-ini date.timezone
selectorctl --apply-global-php-ini date.timezone error_log
The latter command has the same effect as /usr/bin/selectorctl --apply-global-php-ini
Large number of PHP extensions are bundled with each version of PHP:
| bcmath bz2 calendar ctype curl dba dbase dbx domxml exif fileinfo |
ftp gd gettext gmp iconv imap interbase ioncube_loader ioncube_loader_4 json ldap |
mbstring mcrypt mhash mysql ncurses odbc openssl overload pcntl pcre pgsql |
posix pspell readline recode session shmop snmp sockets sourceguardian standard sybase_ct sysvmsg |
sysvsem sysvshm tokenizer wddx xml xmlrpc zlib |
| bcmath big_int bitset bz2 bz2_filter calendar coin_acceptor crack ctype curl date dba dbase dom doublemetaphone exif ftp gd geoip |
gettext gmagick gmp gnupg haru hash huffman iconv idn igbinary imagick imap inclued inotify interbase ioncube_loader ioncube_loader_4 ldap libxml |
lzf mbstring mcrypt memcache msgpack mysql mysqli ncurses odbc openssl pcntl pcre pdo pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite |
pgsql posix pspell quickhash radius readline redis reflection session shmop simplexml snmp soap sockets sourceguardian spl ssh2 standard stats |
stem sybase_ct sysvmsg sysvsem sysvshm tidy timezonedb tokenizer translit wddx xdebug xml xmlreader xmlrpc xmlwriter xsl zlib |
| apc apm ares bcmath bcompiler big_int bitset bloomy bz2 bz2_filter calendar coin_acceptor crack ctype curl date dba dbase dbx dom doublemetaphone eaccelerator enchant exif ffmpeg fileinfo filter |
ftp gd gender geoip gettext gmagick gmp gnupg haru hash hidef htscanner huffman iconv idn igbinary imagick imap inclued inotify interbase intl ioncube_loader ioncube_loader_4 json ldap libxml lzf |
magickwand mailparse mbstring mcrypt memcache memcached mhash mongo msgpack mssql mysql mysqli ncurses oauth odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite |
pgsql phar posix pspell quickhash radius rar readline recode redis reflection rsync session shmop simplexml snmp soap sockets sourceguardian spl spl_types sqlite ssh2 standard stats stem stomp |
suhosin sybase_ct sysvmsg sysvsem sysvshm tidy timezonedb tokenizer translit uploadprogress uuid wddx xcache_3 xdebug xml xmlreader xmlrpc xmlwriter xrange xsl yaf yaz zend_optimizer zip zlib |
| apc apcu apm ares bcmath bcompiler big_int bitset bloomy brotli bz2 bz2_filter calendar clamav coin_acceptor core crack ctype curl date dba dbase dbx dom doublemetaphone eaccelerator eio enchant ereg exif ffmpeg fileinfo |
filter ftp functional gd gender geoip gettext gmagick gmp gnupg haru hash hidef htscanner http huffman iconv idn igbinary imagick imap inclued inotify interbase intl ioncube_loader ioncube_loader_4 jsmin json ldap libevent libxml lzf |
magickwand mailparse mbstring mcrypt memcache memcached mhash mongo msgpack mssql mysql mysqli mysqlnd ncurses nd_mysql nd_mysqli nd_pdo_mysql oauth odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql phalcon phar |
posix propro pspell quickhash radius raphf rar readline recode redis reflection rsync session shmop simplexml snmp soap sockets sourceguardian spl spl_types sqlite sqlite3 ssh2 standard stats stem stomp suhosin sybase_ct sysvmsg sysvsem |
sysvshm tidy timezonedb tokenizer trader translit uploadprogress uri_template uuid wddx weakref xcache xcache_3 xdebug xml xmlreader xmlrpc xmlwriter xrange xsl yaf yaml yaz zend_guard_loader zip zlib zmq |
| apc apcu apm ares bcmath big_int bitset brotli bz2 bz2_filter calendar clamav core ctype curl date dba dbase dbx dom doublemetaphone eaccelerator eio enchant ereg exif ffmpeg fileinfo filter ftp functional gd |
gender geoip gettext gmagick gmp gnupg haru hash hidef htscanner http iconv igbinary imagick imap inclued inotify interbase intl ioncube_loader ioncube_loader_4 jsmin json ldap libevent libsodium libxml lzf magickwand mailparse mbstring |
mcrypt memcache memcached mhash mongo mongodb msgpack mssql mysql mysqli mysqlnd ncurses nd_mysql nd_mysqli nd_pdo_mysql oauth oci8 odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql phalcon phar |
posix propro pspell quickhash radius raphf rar readline recode redis reflection rsync session shmop simplexml snmp soap sockets sourceguardian spl spl_types sqlite3 ssh2 standard stats stem stomp suhosin sybase_ct sysvmsg sysvsem sysvshm tidy |
timezonedb tokenizer trader translit uploadprogress uri_template uuid wddx weakref xcache xcache_3 xdebug xml xmlreader xmlrpc xmlwriter xrange xsl yaf yaml yaz zend_guard_loader zip zlib zmq |
| apcu apm ares bcmath big_int bitset brotli bz2 bz2_filter calendar clamav core ctype curl date dba dbase dbx dom doublemetaphone eio enchant ereg exif ffmpeg fileinfo filter ftp gd gender geoip |
gettext gmagick gmp gnupg gRPC haru hash hidef htscanner http iconv igbinary imagick imap inotify interbase intl ioncube_loader ioncube_loader_4 jsmin json ldap libevent libsodium libxml lzf magickwand mailparse mbstring mcrypt |
memcache memcached mhash mongo mongodb msgpack mssql mysql mysqli mysqlnd ncurses nd_mysql nd_mysqli nd_pdo_mysql oauth oci8 odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql |
phalcon phalcon3 phar posix propro pspell quickhash radius raphf rar readline recode redis reflection rsync session shmop simplexml snmp soap sockets sourceguardian spl spl_types sqlite3 ssh2 standard stats stem stomp suhosin |
sybase_ct sysvmsg sysvsem sysvshm tidy timezonedb tokenizer trader translit uploadprogress uri_template uuid wddx weakref xcache_3 xdebug xml xmlreader xmlrpc xmlwriter xrange xsl yaf yaml yaz zend_guard_loader zip zlib zmq |
| apcu apm ares bcmath big_int bitset brotli bz2 bz2_filter calendar core ctype curl date dba dbx dom doublemetaphone eio enchant ereg exif ffmpeg fileinfo filter ftp gd gender geoip gettext |
gmagick gmp gnupg gRPC haru hash htscanner http iconv igbinary imagick imap inotify interbase intl ioncube_loader ioncube_loader_4 jsmin json ldap libevent libsodium libxml lzf mailparse mbstring mcrypt memcache memcached mhash |
mongo mongodb msgpack mssql mysql mysqli mysqlnd ncurses nd_mysql nd_mysqli nd_pdo_mysql oauth oci8 odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql phalcon phalcon3 |
phar posix propro pspell quickhash radius raphf rar readline recode redis reflection rsync session shmop simplexml snmp soap sockets sourceguardian spl spl_types sqlite3 ssh2 standard stats stem stomp |
suhosin sybase_ct sysvmsg sysvsem sysvshm tidy timezonedb tokenizer trader translit uploadprogress uri_template uuid wddx weakref xcache_3 xdebug xml xmlreader xmlrpc xmlwriter xrange xsl yaml yaz zend_guard_loader zip zlib zmq |
| apcu bcmath bitset brotli bz2 calendar core ctype curl date dba dbase dom eio enchant exif fileinfo filter ftp gd gender |
geoip gettext gmagick gmp gnupg gRPC hash htscanner http iconv igbinary imagick imap inotify interbase intl ioncube_loader json ldap libsodium libxml lzf mailparse mbstring mcrypt |
memcached mongodb mysqli mysqlnd nd_mysqli nd_pdo_mysql newrelic oauth oci8 odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pdo_sqlsrv pgsql phalcon3 phar |
posix propro pspell raphf rar readline redis reflection session shmop simplexml snmp soap sockets sourceguardian spl sqlite3 sqlsrv ssh2 standard stats suhosin sysvmsg |
sysvsem sysvshm tidy timezonedb tokenizer trader uploadprogress uuid vips wddx xdebug xml xmlreader xmlrpc xmlwriter xsl yaml yaz zip zlib zmq |
- Please note that to use newrelic extension you should set your own New Relic License Key in your own /opt/alt/php7*/etc/php.ini file. Please find more info about New Relic License Key in the New Relic documentation .
| apcu bcmath brotli bz2 calendar core ctype curl date dba dbase dom eio enchant exif fileinfo filter ftp gd gender geoip gettext |
gmagick gmp gnupg gRPC hash htscanner http iconv igbinary imagick imap inotify interbase intl ioncube_loader json ldap libsodium libxml lzf mailparse mbstring mcrypt memcached |
mongodb mysqli mysqlnd nd_mysqli nd_pdo_mysql newrelic oauth oci8 odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pdo_sqlsrv pgsql phalcon3 phar |
posix propro pspell raphf rar readline redis reflection session shmop simplexml snmp soap sockets sourceguardian spl sqlite3 sqlsrv ssh2 standard stats suhosin sysvmsg |
sysvsem sysvshm tidy timezonedb tokenizer trader uploadprogress uuid vips wddx xdebug xml xmlreader xmlrpc xmlwriter xsl yaml zip zlib zmq |
- Please note that to use newrelic extension you should set your own New Relic License Key in your own /opt/alt/php7*/etc/php.ini file. Please find more info about New Relic License Key in the New Relic documentation .
| apcu bcmath brotli bz2 calendar core ctype curl date dba dom eio enchant exif fileinfo filter ftp gd gender geoip gettext |
gmagick gmp gnupg gRPC hash http iconv igbinary imagick imap inotify interbase intl ioncube_loader json ldap libxml lzf mailparse mbstring memcached mongodb |
mysqli mysqlnd nd_mysqli nd_pdo_mysql newrelic oauth oci8 odbc opcache openssl pcntl pcre pdo pdo_dblib pdo_firebird pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pdo_sqlsrv pgsql phalcon3 phar |
posix propro pspell raphf readline redis reflection session shmop simplexml snmp soap sockets spl sqlite3 sqlsrv ssh2 standard stats sysvmsg sysvsem |
sysvshm tidy timezonedb tokenizer trader uploadprogress uuid vips wddx xml xmlreader xmlrpc xmlwriter xsl yaml zip zlib zmq |
- Please note that to use newrelic extension you should set your own New Relic License Key in your own /opt/alt/php7*/etc/php.ini file. Please find more info about New Relic License Key in the New Relic documentation .
| apcu bcmath dba dbase dom eio enchant fileinfo gd gender geoip gmagick gnupg grpc http |
igbinary imagick imap inotify interbase intl json ldap lzf mailparse mbstring memcached mongodb mysqlnd nd_mysqli |
nd_pdo_mysql newrelic oauth oci8 odbc opcache pdo pdo_dblib pdo_firebird pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pdo_sqlsrv pgsql |
phar posix propro pspell raphf redis snmp soap sockets sqlsrv ssh2 stats sysvmsg sysvsem sysvshm tidy |
timezonedb trader uploadprogress uuid vips wddx xdebug xmlreader xmlrpc xmlwriter xsl yaf yaml zip zmq |
- Please note that to use newrelic extension you should set your own New Relic License Key in your own /opt/alt/php7*/etc/php.ini file. Please find more info about New Relic License Key in the New Relic documentation .
If you want to disable PHP extension globally, you don't need to remove file /opt/alt/phpXX/etc/php.d.all/$EXTENSION.ini . You should just comment out "extension=" directives in it.
The extension will be visible in PHP Selector interface, but selecting it in users's interface will take no effect - extension will be disabled in fact.
Reinstalling of alt-php packages will not reset settings (will not enable extension again).
[Requires CageFS 5.5-6.18+]
When using EasyApache4 in cPanel, it is possible to change PHP versions for users' domains with MultiPHP Manager (when PHP is working under Apache web server). Also it is possible to change system default PHP version with MultiPHP Manager in WHM.
MultiPHP Manager in WHM looks as follows:
A user can change PHP version for domain in cPanel interface but can not change System default PHP version.
The following Alt-PHP packages (and higher) provide an ability to select Alt-PHP version in MultiPHP Manager :
- alt-php44-4.4.9-71;
- alt-php51-5.1.6-81;
- alt-php52-5.2.17-107;
- alt-php53-5.3.29-59;
- alt-php54-5.4.45-42;
- alt-php55-5.5.38-24;
- alt-php56-5.6.31-7;
- alt-php70-7.0.24-2;
- alt-php71-7.1.10-2;
- alt-php72-7.2.0-0.rc.3.2.
You can remove Alt-PHP from cPanel MultiPHP Manager . To do so set ' yes ' or ' no ' for the Alt-PHP versions in config file /opt/alt/alt-php-config/alt-php.cfg and run /opt/alt/alt-php-config/multiphp_reconfigure.py . This script manages SCL prefixes for the Alt-PHP - removes or creates prefixes in /etc/scl/prefixes .
/opt/alt/alt-php-config/alt-php.cfg
[MultiPHP Manager]
alt-php44 = no
alt-php51 = no
alt-php52 = no
alt-php53 = no
alt-php54 = no
alt-php55 = yes
alt-php56 = yes
alt-php70 = yes
alt-php71 = yes
alt-php72 = yes
::: tip Note PHP Selector does not work when Alt-PHP version is selected as system default in MultiPHP Manager. So, all domains will use PHP version selected via MultiPHP Manager. Settings in PHP Selector will be ignored. We recommend to disable PHP Selector in such case. :::
PHP Selector works in different ways with EasyApache4 and EasyApache3. CageFS should be enabled for users who use PHP Selector . The novation is that when using EasyApache4, actual PHP version used depends on PHP version selected in MultiPHP Manager . When PHP version chosen for domain in MultiPHP Manager matches System default PHP version, then PHP Selector is used to select actual PHP version. If PHP version chosen for domain in MultiPHP Manager differs from System default PHP version, then PHP version from MultiPHP Manager is used.
In other words, PHP Selector deals with changing System default PHP version.
PHP Selector algorithm for choosing PHP version for domain is as follows:
-
If CageFS is disabled, then PHP Selector is not active and MultiPHP Manager PHP version is applied.
-
If CageFS is enabled, then:
2.1. If PHP version chosen in MultiPHP Manager differs from System default PHP version, then MultiPHP Manager PHP version is applied.
2.2. If PHP version chosen in MultiPHP Manager is the same as System default PHP version, then PHP Selector PHP version is applied:
2.2.1. If Native option is selected in PHP Selector , then MultiPHP Manager PHP version is applied.
2.2.2. If PHP version chosen in PHP Selector differs from Native , then PHP Selector PHP version is applied.
PHP version chosen in MultiPHP Manager can also be applied to console commands /usr/bin/php and /usr/local/bin/php . In this case .htaccess file search is performed in current directory and in parent directories. If the file is found, then PHP version specified in it is applied, if not found, then System default PHP version is applied. System default PHP version can be changed via PHP Selector .
-
If CageFS is disabled, then PHP Selector is not active and PHP version from .htaccess is applied.
-
If CageFS is enabled, then:
2.1. If PHP version specified in .htaccess file differs from System default, then .htaccess version is applied.
2.2. If System default PHP version is specified in .htaccess file, then PHP Selector version is applied:
2.2.1. If Native option is chosen in PHP Selector , then .htaccess PHP version is applied.
2.2.2. If PHP version chosen in PHP Selector differs from Native , then PHP Selector version is applied.
::: tip Note cPanel prior to 11.56 does not support hooks to add processing of System default PHP version changes with MultiPHP Manager. That is why System default PHP version changing is handled by cron job (/etc/cron.d/cagefs_cron file), which executes the command /usr/share/cagefs/setup_multiphp_integration every ten minutes, which means that all System default PHP version changes in MultiPHP Manager are applied in CageFS with 10 minutes delay. :::
::: tip Note In cagefs-5.5-6.25 or later, changing of System default PHP version with MultiPHP Manager will be processed with cPanel WHM hooks. :::
PHP Modules
The set of PHP modules depends on PHP version used for domain or console. If PHP Selector is active and Alt-PHP version is chosen, then modules chosen for this Alt-PHP version in PHP Selector are used. If PHP Selector is not active, then modules for PHP version chosen in cPanel MultiPHP are used.
PHP Options
cPanel has MultiPHP INI Editor available in WHM and in cPanel user interface.
MultiPHP INI Editor allows setting PHP options for any PHP version globally for all domains and users. At this point /opt/cpanel/ea-php56/root/etc/php.d/local.ini file is generated and options values are written into this file. Such options have higher priority than the options set in MultiPHP INI Editor in cPanel user interface. MultiPHP INI Editor allows to set PHP options in Basic Mode (simplified interface) and in Editor Mode .
MultiPHP INI Editor in WHM looks as follows:
:::tip Note cPanel prior to 11.56 does not support hooks to add processing of INI options changing for PHP version with MultiPHP INI Editor in cPanel WHM. That is why for now the processing of PHP version changing is handled bycron job (/etc/cron.d/cagefs_cron file) which performs the command /usr/share/cagefs/ setup_multiphp_integration every 10 minutes, which means that INI options changes for PHP version in MultiPHP INI Editor in cPanel WHM are being applied with up to 10 minutes delay. :::
::: tip Note In cagefs-5.5-6.25 or later, INI options changes for PHP version in MultiPHP INI Editor in cPanel WHM will be processed by cPanel WHM hooks. :::
MultiPHP INI Editor in cPanel user interface allows setting options for php.ini files in user home directory or in domain docroot. Changes are applied immediately without delay.
These options priority is lower than ones specified in MultiPHP INI Editor WHM interface. MultiPHP INI Editor in cPanel user interface looks as follows
If PHP Selector is active, then options set in PHP Selector are applied, and such options have higher priority than options in custom php.ini file in domain docroot. If PHP Selector is disabled, then options set in MultiPHP INI Editor are applied.
QUIRKS: When changing System default PHP version, administrator should take into consideration the following quirk. For example, if a user has chosen PHP 5.3 for domain and System default PHP version is PHP 5.5, then PHP Selector will not be used for user domain. In this case, if administrator switches System default PHP version from 5.5 to 5.3, then PHP Selector will be activated for user domain and PHP version chosen in PHP Selector will be applied for domain.
That is why it is recommended for administrator to avoid changing System default PHP version to PHP version that is already used by users. At the same time it is recommended for users to choose inherit for domain and use PHP Selector to choose PHP version. In this case PHP version chosen in PHP Selector will be always applied for domain.



















