Updating PHP 7.4.x to latest 7.4.x

Discussion in 'Installation/Configuration' started by Ph1L, Feb 8, 2023.

Tags:
  1. Ph1L

    Ph1L Member

    Hi all,
    Not sure if this question is in the correct category / section, else move it ;)

    I have a Ubuntu 16.04.0x LTS, running PHP 7.1, 7.2, 7.3 and 7.4. I need to upgrade at least 7.4.x, from 7.4.15 to 7.4.33 (currently latest 7.4.x version).
    If possible, I'll like to update all 7.x to latest 7.x.x. I hope it makes sense..
    apt get update + apt get uppgrade does not update any PHP versions currently on the server.

    Is it possible to add PHP 8.x on Ubuntu 16.04.ox LTS?

    Thanks in advance,
     
  2. Ph1L

    Ph1L Member

    Solution:

    sudo apt update
    sudo apt -y install software-properties-common
    sudo add-apt-repository ppa:eek:ndrej/php
    sudo apt update

    Then:
    sudo apt -y install php7.4 php7.4-common php7.4-fpm php7.4-gd php7.4-mysql php7.4-imap php7.4-cli php7.4-cgi php-pear php7.4-curl php7.4-intl php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php-memcache php-imagick php-gettext php7.4-zip php7.4-mbstring php7.4-soap php7.4-common php7.4-opcache php7.4-mysql

    Restart apache2, enjoy 7.4.33 (currently latest) :-D
     
    ahrasis likes this.
  3. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    That is right. Do the same for other version from php5.6 to 8.2 to update them as well.
     
  4. remkoh

    remkoh Active Member

    How did you manage to install multiple php versions without the ppa: ondrej/php repo?
    Almost every howto about installing multiple PHP versions, especially in Ubuntu, starts with the installation of that.

    Having installed all your PHP version from that repo it should be sufficient to do just this to update to the latest available versions:
    Code:
    apt update
    apt upgrade
    
     
  5. Ph1L

    Ph1L Member

    Multiple version were allready added, but this added all versions from 7.0 to 8.2 actually :D

    However, now LetsEncrypt "died". Can't make new SSL, and /var/log/letsencrypt has not been updated since this.
    No logs, nothing to spot / troubleshoot on. Maybe I should reinstall certbot / LE?
     
  6. Ph1L

    Ph1L Member

    Hmmm:

    I just did this, shocking..
    apt-cache policy certbot | grep Installed
    Installed: (none)
     
  7. remkoh

    remkoh Active Member

    Or if you have not too many websites consider switching to acme.sh
     
  8. Ph1L

    Ph1L Member

    Fix for LE:

    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get install python-certbot-apache
     
  9. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    This is not advisable. Please follow the how to provided by certbot website, which is to install cetbot via snapd and do uninstall previous certbot installation via ppa or others (like certbot-auto) fully / properly before you install certbot via snapd.
     
  10. TonyG

    TonyG Active Member

    I'm facing a similar challenge, need to update official Ubuntu 20.04 PHP 7.4.3 to ondrej 7.4.33 because some WordPress plugins now have that as a dependency (which they probably should not...).

    The plan:
    apt-cache madison php7.4
    - php7.4 | 1:7.4.33-8+ubuntu20.04.1+deb.sury.org+1 | http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages
    - php7.4 | 7.4.3-4ubuntu2.19 | http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
    - php7.4 | 7.4.3-4ubuntu2.19 | http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
    - php7.4 | 7.4.3-4ubuntu1 | http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
    apt install php7.4=1:7.4.33-8+ubuntu20.04.1+deb.sury.org+1​

    Then there is ppa: ondrej/apache2. I don't think we should update Apache from the ondrej repo, and yet I'm not sure if Ubuntu/official Apache is going to conflict with the .33 PHP update.

    a2dismod php7.4.3 (need to check exact mod names)
    a2enmod php7.4.33​

    I'm not sure if that will be necessary. Or if any of this will interact with ISPConfig 3.2.

    I'm setting up for testing/recovery now. Any voice of experience would be welcome now. Thanks.
     
    Last edited: Sep 19, 2023
  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    If you already have sury PHP repo enabled, apt upgrade installs latest php7.4 from there. Has this not happened?
    Code:
    apt policy php7.4
    That is not needed, apt upgade takes care of uninstalling the previous php7.4 and installing and enabling the new.
    How have you configured the new repo in APT settings?
     
  12. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Agreed, just apt to update and upgrade. Ondrej php PPA should work fine as it is also used by ISPConfig Auto Installer.

    Agreed. For now this apache repo is not advisable though to some it works.

    No. It is php7.4 only and sub version does not matter. So as confirmed by @Taleman, no need to do this at all.

    Extra for certbot: Though apt and pip are still a possible choice, to my experience, the best is to use snapd as advised earlier above. Any plugin therefore should also be installed via snapd.

    However apt and pip also can still do the install for certbot, but they are no longer official, and though they may also work with or without twist(s), all plugins must be installed the same way certbot was installed too.
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    In general, do not change the default PHP version of the OS. This will break your system sooner or later. Install newer and older PHP versions that might be needed by a CMS as additional PHP versions, you can then choose the PHP version for that website in website settings in ISPConfig. See here for detailed instructions: https://www.howtoforge.com/ispconfig-php-ubuntu/

    This way you can run your WordPress site even with current PHP 8.2 without breaking your setup.
     
    TonyG likes this.
  14. TonyG

    TonyG Active Member

    Recap - I added PHP 8.2 to the Ubuntu 20 server, reset default to 7.4, and was able to update sites to 8.2 via the selector.
    The instructions on the page provided by Till were flawless.
    Thanks guys!
     
    Th0m, ahrasis and till like this.

Share This Page