Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PhpSwitcher - Howto install PHP versions from Ondřej Surý repository

PhpSwitcher plugin - Howto install PHP versions from an APT repository

Introduction

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

Requirements

  • 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

Then, you're done. You can repeat the above steps for other packaged PHP versions, not forgetting to change the version number.

Installation layout

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.

@nuxwin

This comment has been minimized.

Copy link
Owner Author

commented Oct 5, 2018

result

@nuxwin

This comment has been minimized.

Copy link
Owner Author

commented Oct 5, 2018

other_result

@Speddy

This comment has been minimized.

Copy link

commented Oct 12, 2018

Plugin::PhpSwitcher::_checkPhpVersionData: `/usr/bin/php-cgi7.1' doesn't looks like a PHP FastCGI binary

https://imgur.com/a/SkhXCtm

@nuxwin

This comment has been minimized.

Copy link
Owner Author

commented Oct 13, 2018

@Speddy

Normal... The documentation above is for the upcoming PhpSwitcher version (5.0.0)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.