skip to Main Content

I am trying to install PHP 7.4 on Ubuntu 16.04 for Apache2 server. To install the 7.4 version, I used PPA ondrej repository as follows:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.4
php -v

I get the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package php7.4
E: Couldn't find any package by glob 'php7.4'
E: Couldn't find any package by regex 'php7.4'

I tried all the solutions mentioned in answer to this question:

Unable to install PHP 7.3 on Ubuntu 20.04

None of them helped. How can I install this package?

4

Answers


  1. Your OS Ubuntu 16.04 (Xenial) is too old.
    Ondrej PPA only supports the following operating systems (as of 10 June 2021):

    Hirsute (21.04), Groovy (20.10), Focal (20.04), Bionic (18.04)

    Which is why there is no package found.

    Login or Signup to reply.
  2. You can archive this by adding this 3rd party repository to your system:

    sudo add-apt-repository ppa:jczaplicki/xenial-php74-temp
    sudo apt-get update
    

    CAUTION:

    This is adding an external PPA repository to your system. If you do not trust the maintainer you should not do this, since it possibly exposes your system. Also note that this might work for installing php, but there will not be a guarantee that you recvive updates through it (The word "temp" in the repository name indicates that this is only temporary). I would rather recommend compiling it yourself if you really need to have it installed on 16.04.

    As a "Long-Term Solution" you really should update your system.

    Login or Signup to reply.
  3. I ran into this recently. Luckily, I found a repo containing archives of the original Ondrej PPA. You will be able to install php7.4 and extensions.
    However, I’d be careful with any archives as they can have a security risk.

    sudo add-apt-repository ppa:tomvlk/php-archive
    sudo apt-get update
    
    Login or Signup to reply.
  4. Here are installation instructions for ZendPHP repository – https://help.zend.com/zendphp/current/content/installation/installation.htm

    The ZendPHP installation package replaces Ubuntu 16.04 distribution’s PHP and supports PHP 5.6, PHP 7.1, PHP 7.2, PHP 7.3, and PHP 7.4 on Ubuntu 16.04. Zend also offers PHP LTS for versions that are EOL and no longer receiving high and critical security patches

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search