Add an alternative PHP version
To add an alternative PHP version in ispmanager, you need to create two XML-files.
- The first file adds a new row in Settings → Software configuration and describes the form in Settings → Software configuration → Edit.
For example /usr/local/mgr5/etc/xml/ispmgr_mod_myphp.xml:
<mgrdata>
<lang name="ru">
<messages name="feature">
<msg name="dname_altphp72">Alternative version PHP 7.2</msg>
</messages>
<messages name="feature.edit">
<msg name="package_ispphp72">My PHP 7.2</msg>
<msg name="hint_package_ispphp72">Use PHP 7.2 as CGI</msg>
<msg name="package_ispphp72_mod_apache">PHP as Apache version 7.2</msg>
<msg name="hint_package_ispphp72_mod_apache">Use PHP 7.2 as an Apache module</msg>
<msg name="package_ispphp72_fpm">PHP 7.2 for PHP-FPM</msg>
<msg name="hint_package_ispphp72_fpm">Use PHP 7.2 as PHP-FPM</msg>
<msg name="packagegroup_altphp72gr">PHP 7.2</msg>
<msg name="hint_packagegroup_altphp72gr">Use PHP 7.2</msg>
</messages>
</lang>
</mgrdata>
- The second file descrbes the package of the PHP version you want to add.
For example /usr/local/mgr5/etc/xml/ispmgr_features.d/my_php.xml:
<features>
<feature name="altphp72" featuregroup="altphp">
<packagegroup name="altphp72gr" type="select">
<package name="ispphp72" dispname="PHP 7.2 CGI" primary="yes" recommended="yes">
<systemname>isp-php72</systemname>
</package>
<if value="turn_off" hide="package_ispphp72_mod_apache" shadow="yes"/>
<if value="turn_off" hide="package_ispphp72_fpm" shadow="yes"/>
</packagegroup>
<package name="ispphp72_fpm" dispname="PHP 7.2 PHP-FPM" recommended="yes">
<systemname>isp-php72-fpm</systemname>
</package>
<package name="ispphp72_mod_apache" dispname="PHP 7.2 Apache module">
<systemname>isp-php72-mod-apache</systemname>
</package>
</feature>
</features>
View details
If packages for PHP-FPM and Apache are not present you may not include them into the description. The /opt//etc/php.ini file must be added when the package is installed.
After adding XML files:
- Restart ispmanager:
/usr/local/mgr5/sbin/mgrctl -m ispmgr exit
- Install the new PHP version in Settings → Software configuration.
When adding an alternative version of PHP, ispmanager:
- Installs the required packets and adds records to the database.
INSERT INTO ispfeatures (id, name) VALUES('1', 'altphp90') INSERT INTO isppackages (id, ispfeatures, isprimary, name) VALUES('1', '1', 'on', 'ispphp90') INSERT INTO isppkginfo (feature, id, name, sysname, pkgstate, priority) VALUES('altphp90', '58', 'ispphp90_fpm', 'isp-php80-fpm', '33', '1000'); //For PHP_FPM
- Adds the PHP version path to the configuration file. For example, for PHP 9.0, the control panel will add the parameter isp-php90_cgi-bin with the value of /opt/php90/bin/php-cgi.
If the alternative version of PHP has been installed successfully, at startup the control panel will add to the log file /usr/local/mgr5/var/ispmgr.log a record in the following format:
Dec 30 07:40:58 [2129952:1] php INFO Registering PHP module 'isp-php90'