Adding an alternative PHP version
Custom alternative PHP versions are not supported on CloudLinux.
If the required PHP version is not available in the ispmanager repository, you can add your own build to the control panel. To do this, define the version's packages in two XML files and install the version via the Software configuration section.
In this article, XX and X.X represent the PHP version number within package names and file paths (e.g., isp-phpXX becomes isp-php72).
Requirements for a PHP package
The control panel can work with a PHP version in all modes, provided the package is structured in the same way as ispmanager’s isp-phpXX packages—meaning all files must be located within a single directory (e.g., /opt/php72/).
| File | What it is for |
bin/php-cgi | Required. Without it, the version will not appear in the control panel |
etc/php.ini | Required. The main configuration file for the version |
sbin/php-fpm | PHP-FPM mode. The file must be included in the PACKAGE_NAME-fpm package (e.g., isp-php72-fpm) |
etc/php-fpm.d | PHP-FPM mode. The control panel writes pool configurations to this directory |
bin/lsphp | LSAPI mode (for use with the OpenLiteSpeed or LiteSpeed web server) |
etc/mods-available, etc/php.d | Managing PHP extensions from the control panel |
For the Apache module, the PACKAGE_NAME-mod-apache package must install a module configuration file:
- in Debian-based operating systems:
/etc/apache2/mods-available/phpXX.load - in RHEL-based operating systems:
/etc/httpd/php-available.d/phpXX.conf
Here, phpXX refers to the package name excluding the prefix (the part before the first hyphen); for example, for isp-php72 , it would be php72.
If the package files are located in different directories, the control panel will only be able to use that PHP version in CGI mode. This is the case, for example, with packages from the Sury and Remi repositories.
Each time it starts, the control panel checks the installed primary packages (those with the parameter primary="yes") for alternative PHP versions, as defined in an XML file. For each package, the panel looks for two files:
- The
php-cgiexecutable. First, the panel checks for a path specified in an entry formatted aspath PACKAGE_NAME_cgi-binwithin the/usr/local/mgr5/etc/ispmgr.conffile. If this entry is missing, the panel searches the package's file list for a path ending in/bin/php-cgiand records that path in the configuration file. - The
php.inifile. First, the panel checks for a path specified in an entry formatted aspath PACKAGE_NAME_iniwithin the configuration file. If this entry is missing, the panel looks for anetc/php.inifile located one directory level above thebindirectory (for example, if the path is/opt/phpXX/bin/php-cgi, it looks for/opt/phpXX/etc/php.ini). The panel then records this path in the configuration file.
If either of these files is missing, the PHP version will not appear in the PHP section, even though it is listed as installed under Software configuration.
Steps for adding a PHP version
To add a new alternative PHP version to the panel, log in to ispmanager with superuser rights. Then follow the steps below.
Step 1. Creating XML files
The packages must be available in the connected repositories.
- Go to the File manager section.
Create the file
/usr/local/mgr5/etc/xml/ispmgr_mod_myphp.xmlwith the following content:/usr/local/mgr5/etc/xml/ispmgr_mod_myphp.xml<mgrdata> <lang name="en"> <messages name="feature"> <msg name="dname_altphpXX">Alternative PHP version X.X</msg> </messages> <messages name="feature.edit"> <msg name="package_ispphpXX">My PHP X.X</msg> <msg name="hint_package_ispphpXX">Use PHP X.X as CGI</msg> <msg name="package_ispphpXX_mod_apache">PHP X.X Apache module</msg> <msg name="hint_package_ispphpXX_mod_apache">Use PHP X.X as an Apache module</msg> <msg name="package_ispphpXX_fpm">PHP X.X for PHP-FPM</msg> <msg name="hint_package_ispphpXX_fpm">Use PHP X.X as PHP-FPM</msg> <msg name="packagegroup_altphpXXgr">PHP version X.X</msg> <msg name="hint_packagegroup_altphpXXgr">Use PHP X.X</msg> <msg name="package_ispphpXX_lsapi">PHP X.X LSAPI</msg> <msg name="hint_package_ispphpXX_lsapi">Use PHP X.X as LSAPI</msg> </messages> </lang> </mgrdata>The XML file will add a new item, Alternative PHP version X.X, to the table in the Software configuration section and define a separate settings form for it.
- If there is no
ispmgr_features.ddirectory in/usr/local/mgr5/etc/xml/, create it. To do this, click Create and select Directory in the Type field. Create the file
/usr/local/mgr5/etc/xml/ispmgr_features.d/my_php.xml. This XML file describes the PHP version packages./usr/local/mgr5/etc/xml/ispmgr_features.d/my_php.xml<features> <feature name="altphpXX" featuregroup="altphp"> <packagegroup name="altphpXXgr" type="select"> <package name="ispphpXX" dispname="PHP X.X CGI" primary="yes" recommended="yes"> <systemname>isp-phpXX</systemname> </package> <if value="turn_off" hide="package_ispphpXX_mod_apache" shadow="yes"/> <if value="turn_off" hide="package_ispphpXX_fpm" shadow="yes"/> <if value="turn_off" hide="package_ispphpXX_lsapi" shadow="yes"/> </packagegroup> <package name="ispphpXX_fpm" dispname="PHP X.X PHP-FPM" recommended="yes" if="nginx"> <systemname>isp-phpXX-fpm</systemname> </package> <package name="ispphpXX_mod_apache" dispname="PHP X.X Apache module" if="apache"> <systemname>isp-phpXX-mod-apache</systemname> </package> <package name="ispphpXX_lsapi" dispname="PHP X.X LSAPI" recommended="yes" if="lsapi"> <systemname>isp-phpXX-lsapi</systemname> </package> </feature> </features>DetailsIf the PHP-FPM, Apache module, or LSAPI packages are not being used, remove their descriptions from the file.
CGI
ispphpXX— primary package description. Theprimary="yes"parameter is mandatory; the control panel uses it to identify the version. The<systemname>tag specifies the package name as it appears in the OS package manager.isp-phpXX— package name in the package manager
PHP-FPM
ispphpXX_fpm— package descriptionisp-phpXX-fpm— package name in the package manager
Apache module
ispphpXX_mod_apache— package descriptionisp-phpXX-mod-apache— package name in the package manager
LSAPI
ispphpXX_lsapi— package descriptionisp-phpXX-lsapi— package name in the package manager
Restart the control panel.
How to restart the control panel- Go to the Shell-client section.
Restart the panel with the following command:
/usr/local/mgr5/sbin/mgrctl -m ispmgr exit
- Connect to the server with the ispmanager panel via SSH.
Restart the panel with the following command:
/usr/local/mgr5/sbin/mgrctl -m ispmgr exit
Step 2. Installing a PHP version
Install the added PHP version via the control panel interface.
- Go to the Software configuration section.
- Locate the newly added alternative PHP version in the list.
- Click
on the toolbar. - In the PHP version X.X field, select the primary package.
- If necessary, select the checkboxes for other modes as well.
- Save your changes.
- Wait for the PHP version installation to complete.
Once successfully installed, the version will appear in the PHP section. If the added version is marked as installed but does not appear in the PHP section, manually update the file paths.
Step 3. Manually specifying PHP file paths
The control panel registers a version only if both the php-cgi executable and the php.ini configuration file are present. These files define the CGI mode. Other modes are supplementary; without CGI, the PHP version will not appear, even if files for other modes exist.
If the package has installed php-cgi and php.ini into directories not recognized by the control panel, specify the paths manually.
- Go to the File manager section.
- Open the control panel's configuration file:
/usr/local/mgr5/etc/ispmgr.conf. Add the required lines using the following template.
PACKAGE_NAMEcorresponds to the value of the<systemname>tag for the primary package (whereprimary="yes") from themy_php.xmlfile:path PACKAGE_NAME_cgi-bin PATH_TO_PHP-CGI path PACKAGE_NAME_ini PATH_TO_PHP.INILine examples:
Debian-based OS, packages from the sury repository. The primary package is phpX.X-cgi, notphpX.X-clipath phpX.X-cgi_cgi-bin /usr/bin/php-cgiX.X path phpX.X-cgi_ini /etc/php/X.X/cgi/php.iniRHEL-based OS, packages from the Remi repository. The primary package is phpXX-php-cli. The control panel will automatically detect the path tophp-cgi; you only need to correct the path tophp.inipath phpXX-php-cli_ini /etc/opt/remi/phpXX/php.ini- Save the changes.
Restart the control panel.
How to restart the control panel- Go to the Shell-client section.
Restart the panel with the following command:
/usr/local/mgr5/sbin/mgrctl -m ispmgr exit
- Connect to the server with the ispmanager panel via SSH.
Restart the panel with the following command:
/usr/local/mgr5/sbin/mgrctl -m ispmgr exit
The control panel does not modify existing lines in the file. If a path is specified incorrectly, the version will not appear in the PHP section. Correct the line or delete it; the control panel will then automatically detect the correct path the next time it runs.
Step 4. Verifying the result
- Go to the File manager section.
- Open the panel log at
/usr/local/mgr5/var/ispmgr.log. - In the Number of rows displayed field, select 5000. The log opens in read-only mode and shows only the last lines, 50 by default.
If the alternative PHP version has been successfully installed, an entry similar to the following will appear in the log:
Sep 30 07:40:58 [2129952:1] php INFO Registering PHP module 'isp-phpXX'The entry is written when the control panel starts, so open the log right after the restart.
You can also find the entry in the Shell-client section with the following command:
grep "Registering PHP module" /usr/local/mgr5/var/ispmgr.log | tailTechnical details for adding a PHP version
Configuration files
| File | RHEL-based operating systems | Debian-based operating systems |
Panel configuration file containing paths to php-cgi and php.ini | /usr/local/mgr5/etc/ispmgr.conf | /usr/local/mgr5/etc/ispmgr.conf |
| Version names in the interface | /usr/local/mgr5/etc/xml/ispmgr_mod_NAME.xml | /usr/local/mgr5/etc/xml/ispmgr_mod_NAME.xml |
| Descriptions of version packages | /usr/local/mgr5/etc/xml/ispmgr_features.d/NAME.xml | /usr/local/mgr5/etc/xml/ispmgr_features.d/NAME.xml |
| Apache module configuration file | /etc/httpd/php-available.d/phpXX.conf | /etc/apache2/mods-available/phpXX.load |
Log
The control panel logs information to /usr/local/mgr5/var/ispmgr.log. If a version does not appear in the PHP section, check the log for warnings containing the phrase Skip registering. For example, the message Main ini file (…) for 'isp-php72' package is missed indicates that the control panel could not locate the php.ini file.