PhpSwitcher and PHP 7.2

  • Thanks!

    How can we change the default version in the plugin?


    I couldn't find that in the documentation.

    You need switch to the customer interface, then in the "domains" section, you'll see a new menu on left, labeled "PHP Switcher". Through this interface, you can switch between various PHP versions, on a per site basis. You need just to select the site on which you want operate on, then select the PHP version you want use. On selection, the frontEnd will automatically schedule a PHP version change.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Okay, yes, this way I understood,
    So there is no way to set the default version on all customers at once or set a default that is automatically used on newly created customers?

  • Okay, yes, this way I understood,
    So there is no way to set the default version on all customers at once or set a default that is automatically used on newly created customers?

    Currently, there is no way to set default PHP version for all customers as per PhpSwitcher plugin provided PHP versions. That something we could add in a later version.


    Right now, the default PHP version for new domains and subdomains is the system PHP version, that is, the one you have choose during i-MSCP installation. You can always change the system default PHP version by re-running the i-MSCP installer: perl imscp-autoinstall -dr php. The selected version will be the PHP version used by the i-MSCP control panel, but also the default PHP version for the domains and subdomains.


    Hope you understand me right.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Still in progress... I'm working at many levels... Hard... Will try to deliver an update for the current i-MSCP version next week. Sorry for the delays...

    Hi Nuxwin


    Is there any progress? My clients asking this a lot..

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

  • For those who can't wait for the next release, for those who know what they are doing, for those who understand how to use the root user and its power, for those who are able to recover a broken system, there's a quick and dirty method to add php7.2 and php7.3 to the phpswitcher plugin.


    Keep in mind that:

    - not all the modules are compiled, just the modules for my needs

    - there could be some errors (I'm sure there are)

    - this is only "tested" on Debian 9 amd64 with my personal configuration (standard) that could differ from yours

    - you know what you are doing

    - THERE IS NO SUPPORT

    - just to be clear, THERE IS NO SUPPORT


    So, let's begin:

    1. Install dependencies:

    Code
    1. apt install libzip-dev libopenmpi-dev libc6-dev libnewlib-dev valgrind libarb-dev libxml2-dev libsodium-dev libpth-dev libzfslinux-dev makedev

    2. Link some needed libraries:

    Code
    1. ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
    2. cd /usr/include
    3. ln -s x86_64-linux-gnu/curl

    FOR PHP 7.2


    There's only modules.ini missing now, we need to "build" it:

    Code
    1. ls -1 /opt/phpswitcher/$compDate/php7.2/lib/php/20170718-zts-debug/ | grep .so > /opt/phpswitcher/$compDate/php7.2/etc/php/conf.d/modules.ini
    2. sed -i -e 's/^/extension = /' /opt/phpswitcher/$compDate/php7.2/etc/php/conf.d/modules.ini
    3. sed -i 's/extension = opcache.so/zend_extension = opcache.so/g' /opt/phpswitcher/$compDate/php7.2/etc/php/conf.d/modules.ini

    Last Step:

    edit file /opt/phpswitcher/$compDate/php7.2/etc/php/conf.d/modules.ini with your favorite editor and

    1. invert lines mysqli.so and mysqlnd.so

    2. move opcache.so to top (first line) of the file


    edit file /opt/phpswitcher/$compDate/php7.2/etc/php-fpm.conf with your favorite editor and change what follows:

    Code
    1. ;pid = run/php-fpm.pid => pid = /var/run/phpswitcher/psw7.2-fpm.pid
    2. ;error_log = log/php-fpm.log => error_log = /var/log/phpswitcher/psw7.2-fpm.log
    3. ;syslog.ident = php-fpm => syslog.ident = psw7.2-fpm
    4. ;emergency_restart_threshold = 0 => emergency_restart_threshold = 10
    5. ;emergency_restart_interval = 0 => emergency_restart_interval = 1m
    6. ;process_control_timeout = 0 => process_control_timeout = 60s
    7. ;daemonize = yes => daemonize = yes

    edit file /opt/phpswitcher/$compDate/php7.2/etc/php/php.ini with your favorite editor and change what follows:

    Code
    1. short_open_tag = Off => short_open_tag = On
    2. ;cgi.fix_pathinfo=1 => cgi.fix_pathinfo=1

    FOR PHP 7.3

    There's only modules.ini missing now, we need to "build" it:

    Code
    1. ls -1 /opt/phpswitcher/$compDate/php7.3/lib/php/20180731-zts-debug/ | grep .so > /opt/phpswitcher/$compDate/php7.3/etc/php/conf.d/modules.ini
    2. sed -i -e 's/^/extension = /' /opt/phpswitcher/$compDate/php7.3/etc/php/conf.d/modules.ini
    3. sed -i 's/extension = opcache.so/zend_extension = opcache.so/g' /opt/phpswitcher/$compDate/php7.3/etc/php/conf.d/modules.ini

    Last Step:

    edit file /opt/phpswitcher/$compDate/php7.3/etc/php/conf.d/modules.ini with your favorite editor and

    1. invert lines mysqli.so and mysqlnd.so

    2. move opcache.so to top (first line) of the file


    edit file /opt/phpswitcher/$compDate/php7.3/etc/php-fpm.conf with your favorite editor and change what follows:

    Code
    1. ;pid = run/php-fpm.pid => pid = /var/run/phpswitcher/psw7.3-fpm.pid
    2. ;error_log = log/php-fpm.log => error_log = /var/log/phpswitcher/psw7.3-fpm.log
    3. ;syslog.ident = php-fpm => syslog.ident = psw7.3-fpm
    4. ;emergency_restart_threshold = 0 => emergency_restart_threshold = 10
    5. ;emergency_restart_interval = 0 => emergency_restart_interval = 1m
    6. ;process_control_timeout = 0 => process_control_timeout = 60s
    7. ;daemonize = yes => daemonize = yes


    edit file /opt/phpswitcher/$compDate/php7.3/etc/php/php.ini with your favorite editor and change what follows:

    Code
    1. short_open_tag = Off => short_open_tag = On
    2. ;cgi.fix_pathinfo=1 => cgi.fix_pathinfo=1


    After each step read what your console output tells you, if everything is ok, go to the next step.

    To finish:

    Go to your i-MSCP Panel and add the 2 new version as you will do with a "normal" version


    Hope it helps.

    Edited once, last by kess ().