PhpSwitcher force-last fail

  • I would like to update my php version to latest, for security reasons.

    Run the following command, and result has error:

    perl --auto-setup --force-last 5.6 7.0 7.1

    The error is:

    1. Applying patch nxw_fpm_config.patch
    2. patching file sapi/fpm/Makefile.frag
    3. patching file sapi/fpm/
    4. Hunk #7 FAILED at 124.
    5. 1 out of 7 hunks FAILED -- rejects in file sapi/fpm/
    6. Patch nxw_fpm_config.patch does not apply (enforce with -f)
    7. /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/Makefile:286: recipe for target 'patch-stamp' failed
    8. [ERROR] main: An unexpected error occurred: An error occurred while executing the install MAKE(1) target for php-5.6.36: make: *** [patch-stamp] Error 1

    OS: Debian Jessie 8.10
    i-MSCP: 1.5.x-konzeptplus
    PhpSwitcher version: 4.0.3

    i-MSCP 1.5.3
    Plugins (latest version): ClamAV, CronJobs, DomainAutoApproval, LetsEncrypt, OpenDKIM, PanelRedirect, PhpSwitcher, PolicydSPF, Postgrey, RecaptchaPMA, RoundcubePlugins, SpamAssasin, WHMCS

  • This is expected. Don't use the --force-last flag as the patches need to be refreshed. A new PhpSwitcher plugin version will be released as soon as possible.


  • Hi nuxwin,

    your information from May in mind, when we can actually expect update of non-free plugin phpswitcher so newer php versions i.e. 5.6.38 and 7.1.22 can be installed ? The PHP-versions we actually can install by phpswitcher are outdated since 11 months :( and the switch force-last ends in errors X/
    We know you are very busy on next step version imscp, perhaps it is possible only to upgrade the patch-files in the actual downloadable phpswitcher-plugin so PHP 5.6 and 7.1 can be updated to current version ?
    Thanks in advance for your response and updated phpswitcher-patchfiles.

  • 101host

    I'll try to refresh the patches for the already supported versions this week.


  • 101host

    Should I really update the patches for self-compiled versions or can you live with the following solution: PhpSwitcher plugin - Howto install PHP versions from Ondřej Surý repository

    Basicallly put, making use of PHP versions as provided by Ondry Sury make you able to beneficiate of latest versions without waiting for newest PhpSwitcher plugin version. This make you also able to install PHP extension using APT, enabling/disabling them using distribution PHP tools such as phpenmod/phpdismod.

    Right now, you cannot use the PHP versions from Ondřej Surý repository with the latest available PhpSwitcher version (4.0.3) as the version matching pattern is too restrictive but there will be a new version (4.0.4) fixing that issue that will be released either this evening or tomorrow. If this solution is fine for you, this could save me a bit time even if in near future, I'll update the pacthes for self-compiled versions.



  • 101host

    I'll release the plugin in few hours. I've finally updated all patches for self-compiled versions and also added support for PHP 7.2, 7.3... To resume, with next version, you'll be able to:

    If you use the Fcgid i-MSCP server implementation (not recommended):

    1. Setup PHP 4.4, 5.2, 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3 (self-compiled versions)
    2. Setup PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.x ... (packaged PHP versions)

    If you use the FPM i-MSCP server implementation (recommended):

    1. Setup PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3 (self-compiled versions)
    2. Setup PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.x ... (packaged PHP versions)

    And of course, in both cases, I recommend usage of packaged versions over self-compiled versions...

    Sorry for the delay.


  • Nuxwin

    Hi , can you please give us a short information-update? .. perhaps a little workaround (codepatch in current phpswitcher-version) so we can include PHP7.2 and perhaps PHP 7.1 update from Ondry Sury ? We have to act for our customers :thumbup: Thx a lot in advance.

    Edited once, last by 101host ().

  • 101host

    Good morning,

    Sorry for late answer. You can find the instructions below but note that I'll not provide any support for such manual changes if you do something wrong.

    Edit the /var/www/imscp/gui/plugins/PhpSwitcher/backend/ file and replace the following lines:


    1. if ( $rs || $stdout !~ /PHP\s+(\d+)\.(\d+)\.(\d+)\s+\(cgi-fcgi\)/ ) {


    1. if ( $rs || $stdout !~ /PHP\s+(\d+)\.(\d+)\.(\d+).*?\s+\(cgi-fcgi\)/ ) {


    1. if ( $rs || $stdout !~ /PHP\s+(\d+)\.(\d+)\.(\d+)\s+\(fpm-fcgi\)/ ) {


    1. if ( $rs || $stdout !~ /PHP\s+(\d+)\.(\d+)\.(\d+).*?\s+\(fpm-fcgi\)/ ) {

    Once done, create the /etc/imscp/listeners.d/ file with the following content:

    Then, look at the following howto to setup additional PHP versions from Ondřej Surý repository:…0ad81680521db5e445587af22

    Bear in mind that in the current PhpSwitcher plugin version (4.0.3) a psw<version>-fpm service will be created, even for Ondřej Surý PHP versions. So, basically, you SHOULD disable the default php<version>-fpm service that is provided by the package. The current version of the plugin will only act on the psw<version>-fpm service. Assuming systemd as init system, you can disable the default provided service as follows:

    1. # systemctl stop php<version>-fpm
    2. # systemctl disable php<version>-fpm
    3. # systemctl mask php<version>-fpm

    You need to do that only for additional PHP versions, that is, those setup for the PhpSwitcher plugin. Don't do that for the default PHP version which you selected through i-MSCP installer. In the coming PhpSwitcher version (5.0.0), the plugin will make use of the default service as provided by the package as it will be able to differentiate self-compiled versions of packaged versions.

    Regarding Ondřej Surý packaged PHP versions: You need manage these versions as usually. PHP extensions need to be installed through APT and can be enabled/disabled using the php(en|dis)mod tool. If you do so, don't forget to restart the psw<version>-fpm service once after.