Rouncube, several php versions and composer

Discussion in 'Installation/Configuration' started by francoisPE, Dec 15, 2020.

  1. francoisPE

    francoisPE Member HowtoForge Supporter

    Hello,
    I set up a server (perfect server ubuntu 20.04) I add several php versions :
    "add-apt-repository ppa:eek:ndrej/php" -> php5.6, 7.0, 7.1, 7.2, 7.3 + 7.4
    I modify ispconfig to have several version and it works fine.
    Yesterday I run apt update, upgrade and now when trying to open myserver:8080/webmail, I have following message :
    -> Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5"

    I check "update-alternatives --config" for fpm and cgi. Default is 7.4
    I switch to composer-2 and update dependencies...
    Roundcube logs are 10 days old... without anything interesting !
    I don't see how to solve !

    My thinking is that default version is 7.4. I can't choose php version for Roundcube, so should be default.

    I don't know where to look for ?
     
  2. francoisPE

    francoisPE Member HowtoForge Supporter

    Any idea ?
     
  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    You could run phpinfo to find out what version is your default. Possibly you have multiple php-fpm config versions enabled in apache. Also I don't know how ubuntu is setup, but I would expect it to be the same as debian, in that update-alternatives does not set the default php-fpm version.
     
  4. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    1. I don't recall installing RC using composer in the PST, so, I don't think you should use it.

    2. It says you can use php7.2.5 and higher, therefore, there is no reason why it is not working with php7.4.

    3. Do check your vhost as sometimes the old custom conf folder might still in work causing old php is still being used unknowingly.
     
  5. francoisPE

    francoisPE Member HowtoForge Supporter

    @ahrasis
    I install some plugins with roundcube (cardav) that is why I have use composer...
    I check /usr/local/ispconfig/server/conf-custom/*, there are only 'empty.dir' in.

    In https://www.howtoforge.com/tutorial...fig-3-from-debian-packages-on-debian-8-and-9/, (adapted to ubuntu thanks to Taleman) I saw that it is required to run all php-fpm through 'service php5.6-fpm restart', 'service php7.0-fpm restart', etc...
    I stop the several php-fpm running in parallel on my server except php7.4-fpm
    Now, my issue seems to be no php running as 'default'
    If I try in firefox to access to mydomain.fr, it works.
    if I try mydomain.fr/webmail, it doesn't work... Error 503, service unavailable...

    So that I am thinking that Jesse is true : my issue is to "set the default php-fpm version"
    I don't know where it defined but it seems that default version isn't likned with running version !?
     
  6. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

  7. francoisPE

    francoisPE Member HowtoForge Supporter

    Very nice !
     
  8. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Curious, in checking the howto you linked to above (which could use a rewrite/update nowadays), there is no mention of setting the default php-fpm version, except for in the comments where it is incorrectly shown to enable multiple versions.

    The short of it is: if you have any mod_php version enabled, that will be the default php interpreter - so uninstall all mod_php versions first, then use a2enconf to enable (only) the correct version for your OS (so 'a2enconf php7.4-fpm' for you).

    @ahrasis' script to monitor it is probably not a bad idea. I haven't had versions change when I do updates, but it does print the commands to do so on the command prompt, so if you unwittingly ran those commands manually, you could inadvertently switch to a different version.
     
    Last edited: Dec 24, 2020
  9. francoisPE

    francoisPE Member HowtoForge Supporter

    My question is why run a cronjob every 10 minutes... Is ispconfig changing php version ?

    @Jesse Norell :
    [email protected]:~# a2query -m php7.4
    php7.4 (enabled by maintainer script)
    [email protected]:~# a2query -m php7.3
    No module matches php7.3
    [email protected]:~# a2query -m php7.2
    No module matches php7.2
    [email protected]:~# a2query -m php7.1
    No module matches php7.1
    [email protected]:~# a2query -m php7.0
    No module matches php7.0
    [email protected]:~# a2query -m php5.6
    No module matches php5.6
    Seems that php7.4 is default !?
    May be my concern is coming from the fact I 'a2enconf' all php on my server : 5.6, 7.0, etc, 7.4 !
    I don't understand what is required to allow ispconfig to direct to selected version...
     
  10. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Don't a2enconf multiple php-fpm versions.
     
  11. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Nope. There is definitely no reason for me to change default php even unwittingly for live server and I seldom ssh to my server except when failure is reported via emailed.

    I do set automatic software update and upgrade causing default php to change sometimes and settings auto check and fix script works for me, so my job of maintaining my server manually is lesser.

    Oh yeah, as later suggested in my thread, now I use monit to monitor instead of cron job every 10 minutes.
     
  12. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    My experience is that on Debian and Ubunty systems the most recently installed PHP version becomes the system default. So if PHP 8.0 gets installed, and it was not installed before, it becomes the default PHP. This does not apply if PHP is installed not using the APT system.
    ISPConfig does not change the system default PHP.
    Ubuntu and Debian do not change dystem default PHP willy-nilly. dist-upgrade to next release may do that. Or the process of installing a version of PHP that was not installed before.
    EDIT
    I forgot to write: the system default PHP version can be changed with
    Code:
    update-alternatives --config php
    update-alternatives --config php-cgi
     
    Last edited: Dec 27, 2020
    ahrasis likes this.
  13. francoisPE

    francoisPE Member HowtoForge Supporter

    Thanks a lot, I 'a2enconf' only 7.4 and my php7.4 is back to life (not RC, but, probably composer failure...)
    Your comments bring a question : what are the differences between
    update-alternatives --set php /usr/bin/php7.2
    &
    update-alternatives --config php
    update-alternatives --config php-cgi
    &
    update-alternatives --all

    When running 'update-alternatives --all', it asks you several queries and 3 concerning php
    (1)--> /usr/bin/php7.4
    (2)--> /usr/bin/php-cgi7.4
    (3)--> /usr/lib/cgi-bin/php7.4
    (1) seems to be same as update-alternatives --set php /usr/bin/php7.4, and, update-alternatives --config php with choice 7.4
    (2) seems to be 'update-alternatives --config php-cgi' Probably equal to 'update-alternatives --set php-cgi /usr/bin/php-cgi7.4' ??
    (3) Should I do 'update-alternatives --set ??? /usr/lib/cgi-bin/php7.4' or 'update-alternatives --config ???' What is the attribute '???' ?
     
  14. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I think the above the first is the one line command if compared to the later it, which is interactive.

    In a script you don't want things to be done interactively, but you might want such interaction when you do it manually.
     
  15. francoisPE

    francoisPE Member HowtoForge Supporter

    @ahrasis, as you mention in your https://www.howtoforge.com/community/threads/monitor-os-default-php-and-restore-if-changed.83288/, I am trying in monitrc :
    @Taleman, i would like to do like update-alternatives --config php & update-alternatives --config php-cgi :
    "
    check directory with path /etc/php/7.4/fpm
    if changed timestamp then exec "/usr/bin/update-alternatives --set php /usr/bin/php7.4"
    check directory with path /etc/php/7.4/cgi
    if changed timestamp then exec "/usr/bin/update-alternatives --set php-cgi /usr/bin/php-cgi7.4"
    if changed timestamp then exec "/usr/bin/update-alternatives --set php-cgi-bin /usr/lib/cgi-bin/php7.4"
    "
    What do you thing ? Am I correct ?
     
    Last edited: Jan 4, 2021
  16. francoisPE

    francoisPE Member HowtoForge Supporter

    small syntax update
    "
    check directory fpm-dir with path /etc/php/7.4/fpm
    if changed timestamp then exec "/usr/bin/update-alternatives --set php /usr/bin/php7.4"
    check directory cgi with path /etc/php/7.4/cgi
    if changed timestamp then exec "/usr/bin/update-alternatives --set php-cgi /usr/bin/php-cgi7.4"
    if changed timestamp then exec "/usr/bin/update-alternatives --set php-cgi-bin /usr/lib/cgi-bin/php7.4"
    "
     
    Last edited: Jan 4, 2021
  17. francoisPE

    francoisPE Member HowtoForge Supporter

    what do you think ?
     

Share This Page