Select PHP version for PHP CLI

Discussion in 'Installation/Configuration' started by ewkilian, Oct 16, 2019.

  1. ewkilian

    ewkilian Member

    Hi,
    I followed this tutorial to add PHP 7.1 on ISPCONFIG
    https://www.howtoforge.com/tutorial/how-to-install-php-7-on-debian/
    The installation was successfull, on IPSconfig I can choice PHP7.1 and that run.
    But this is not activate on CLI PHP
    You can see
    [email protected]:/home/ewkilian# php -v
    PHP 5.6.33-0+deb8u1 (cli) (built: Jan 5 2018 15:46:26)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with XCache v3.2.0, Copyright (c) 2005-2014, by mOo
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with XCache Optimizer v3.2.0, Copyright (c) 2005-2014, by mOo
    with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
    with XCache Coverager v3.2.0, Copyright (c) 2005-2014, by mOo

    Can you help me to activate php 7.1 when I use PHP CLI.

    Thnak you for your help
     
  2. exynenem

    exynenem Member

    Just create a symlink to the php 7.1 cli binary under /usr/bin
    Kinda like this: ln -s <path_to_your_7.1_cli-bin> /usr/bin/php71-cli

    If you don't want to use PHP 7.1 this way you'll have to upgrade you packages to 7.1. I think sury repository is a quiet popular address in this case.
    However, I cannot recommend this step as of now since ISPConfig isn't compatible with 7.1 yet.
    If I am wrong here please let me/us know @till.

    So, you'll probably have to stick to PHP 5.6 or 7.0 (at max) if you still want to run ISPConfig on your server.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    That's wrong, ISPConfig is compatible up to PHP 7.3. The problem is something different, you should not change the default PHP version of your OS as all applications of your OS incl. ISPConfig depend on that version. If you want to have a newer PHP version on Debian, then better update to debian 10 which comes with PHP 7.3.
     
  4. nhybgtvfr

    nhybgtvfr Active Member

    I assume, since you're trying to change the php version on websites, this is also to change the php version for that websites ssh user.
    if so, then install the additional php's as normal, either in /opt following the tutorials, or /etc/php/#.# using the ondrej repo.
    add them in the ispconfig panel as normal.

    then add the php version to the jailkit, I currently have this in my /etc/jailkit/jk_init.ini file:

    Code:
    [php]
    comment = The PHP Interpreter and Libraries
    executables = /usr/bin/php, /usr/bin/php7.3, /usr/bin/php7.2, /usr/bin/php5.6
    directories = /usr/lib/php, /usr/share/php, /usr/share/php, /etc/php, /usr/share/php-geshi, /usr/share/zoneinfo
    includesections = env
    
    then create your ssh user, or update the existing jail as normal, login as that user, and then in
    /var/www/<vhostname>/home/<username>/
    create a .bashrc file containing an alias for whatever php version you want eg:
    alias php='/usr/bin/php7.3'

    save the file, logout and log back in ( or source ~/.bashrc ) and then run php -v to confirm it's the right version.

    would be nice if ispconfig did this automatically, so it matched the cli version to the php-fpm version selected for the website
     
  5. ewkilian

    ewkilian Member

    Thank you all for your reply. Je try your suggestion.
    Bye
     

Share This Page