Debian - Upgrading from Debian 10 to 11 - how to keep php7.3?

Discussion in 'Installation/Configuration' started by grafik, Sep 20, 2021.

  1. grafik

    grafik New Member

    Hi there,

    I've updated my Debian server from 10 to 11. I didn't do an aptitude full-upgrade, but worked with apt-get dist-upgrade in order to make a step by step update, if anything goes wrong. Now I have php7.3-fpm and php7.4-fpm running, and I also use ISPconfig and I'm able to select for websites which php version to use. I've added both php7.3 and php7.4 as php alternatives in the ISPconfig settings and everything works fine, BUT....
    I have one more package which nees to be upgraded, and that is php-common. If i try to install, update it manually, doing an apt-get install php-common, than apt wants to remove php7.3. I want to keep also php7.3. What is the correct aproach to achieve this?
    Thank you!

    root@whatever:~# apt-get install php-common
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      libicu63 librecode0 libtidy5deb1 libxmlrpc-epi0
    Use 'apt autoremove' to remove them.
    The following packages will be REMOVED:
      libapache2-mod-php7.3 php7.3 php7.3-cgi php7.3-cli php7.3-common php7.3-curl php7.3-fpm php7.3-gd php7.3-imap php7.3-intl php7.3-json php7.3-mbstring
      php7.3-mysql php7.3-opcache php7.3-pspell php7.3-readline php7.3-recode php7.3-soap php7.3-sqlite3 php7.3-tidy php7.3-xml php7.3-xmlrpc php7.3-xsl
    The following packages will be upgraded:
    1 upgraded, 0 newly installed, 24 to remove and 0 not upgraded.
    1 not fully installed or removed.
    Need to get 15.6 kB of archives.
    After this operation, 36.1 MB disk space will be freed.
    Do you want to continue? [Y/n]
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Since this post is not in ISPConfig board, I assumed you are not using it but I think the correct approach will be the same i.e. to use Ondrej Sury repo to install multiple php then you may choose php that you want to be default and set it up.

    This tutorial helps one to install multiple php to be used with ISPConfig but the guide should be useful to non ISPConfig users as well.
    grafik likes this.
  3. grafik

    grafik New Member

    Thank you for the reply, but different php versions are already installed and working. My problem is, that apt wants to remove older php version. And yes, I'm using ISPconfig, as I mentioned above.
    I thought that maybe there is a solution to tell apt, not to remove packages, some kind of hack with apt-mark maybe.
    So my purpose is to use only debian repositories, and update php-common package, without removing already installed php7.3.
    php-common : Breaks: php7.3-common
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I know of no such hack. There are --force options to make apt do the command even if it breaks things, though.
    What works is you create your own php-common package that does not have that breaks php7.3-common statement. I am sure this works since Ondrej Sury already does it. He is maintainer of PHP for Debian and Ubuntu, so he should know how it is done.
    I know very little about PHP maintenance, but I would assume it is very complicted to get it right when using multiple PHP versions. So I just use what Ondej Sury makes and do not even try to make it myself.
    grafik likes this.
  5. grafik

    grafik New Member

    Thank you @Taleman. It seems that it's the only solution which exists. I mean, I updated php-common, which removed php7.3 and after that I've added the repository which made it possible to reinstall php3 also. So my understanding is, that Debian 11 (Bullseye) supports natively by default just php 7.4 as the lowest version of Php. On the other hand, it's a good practice also to add repository, because it has already php8.0 and some php8.1 packages.

    Thanks for the help guys! Have a great day!
    ahrasis likes this.
  6. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Well, that is exactly how it works. In general, the latest version of php will always be installed removing the old ones except when they are php{version}-specific.

Share This Page