PhpSwitcher plugin - Howto install PHP versions from an APT repository
The PHP compiler script that is shipped with the PhpSwitcher plugin only provides support for PHP self-compiled versions. However, it's also possible to install PHP versions from an APT repository and register them in the plugin.
Example for PHP 7.0 from Ondřej Surý APT repository
- i-MSCP ≥ 1.5.0
- PhpSwitcher plugin ≥ 5.0.0
A version of the PhpSwitcher plugin at least equal to version 5.0.0 is REQUIRED as the version matching pattern was too restrictive in older versions.
Install the required packages
# apt-get update # apt-get install php7.0-cgi php7.0-fpm
Note that only required packages are installed here, out of any additional PHP extension consideration.
The Ondřej Surý repository SHOULD be already present in the
/etc/apt/sources.list file as it is an i-MSCP requirement.
Register new PHP 7.0 version into the PhpSwitcher plugin
- Go to the PhpSwitcher administration interface (admin settings section)
- Setup your new PHP versions as follows:
- Common settings
- Path to PEAR directory: /usr/share/php
- PHP CGI/FastCGI settings
- Path to binary: /usr/bin/php-cgi7.0
- PHP FPM/FastCGI settings
- Path to binary: /usr/sbin/php-fpm7.0
- Path to configuration file: /etc/php/7.0/fpm/php-fpm.conf
- Path to pool directory: /etc/php/7.0/fpm/pool.d
- Common settings
Then, you're done. You can repeat the above steps for other packaged PHP versions, not forgetting to change the version number.
Contrary to self-compiled PHP versions, those from APT repository have not specific installation layout. You need manage these versions as you would do with a bare Debian PHP installation, that is, without i-MSCP.
Additional PHP extensions
If you need additional PHP extensions, you MUST install them using APT. If you do so, you should also rebuild the related static phpinfo file through the PhpSwitcher administration interface.
i-MSCP installer - Packages uninstallation
The installer from current stable i-MSCP version automatically purge packages that belong to unselected PHP versions. To avoid that, the plugin automatically install a listener file that act as filter for those packages.