Reputation: 1159
I need to deploy a PHP application that was built on PHP 7.3` in 2019.
It is dockerized and the Dockerfile tries to install it from a well know repository:
RUN apt-add-repository -y ppa:ondrej/php
While doing so, it emits the following error message:
E: Unable to locate package php7.3-cli E: Couldn't find any package by glob 'php7.3-cli' E: Couldn't find any package by regex 'php7.3-cli'
Now I'm puzzled as I read it that this repository no longer supports PHP 7.3 and installs the php8.2
package instead.
I couldn't get it to work with PHP for a couple of years and wasn't able to find any Personal Package Archive (PPA) for older PHP releases.
The relevant part of my Dockerfile:
FROM phusion/baseimage:bionic-1.0.0-amd64
# generate locales
RUN locale-gen en_US.UTF-8 ru_RU.UTF-8
RUN apt-add-repository -y ppa:ondrej/php
RUN apt-get update; apt-get install -y --no-install-recommends php7.3-cli
Upvotes: -1
Views: 2589
Reputation: 197544
The PPA description requires reading:
Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided.
While the first link shows what PHP is (and their maintenance plan), the PHP versions for supported Ubuntu releases are just those of the distribution packaging, they have their own maintenance plan.
When a distribution is released, it normally ships with a specific PHP version and as long as the distribution release is supported that PHP version stays with it.
That only for clarification upfront, about the actual issue you see the diagnostic message: The repository you have in use does indeed not offer the php7.3 package any longer. That is because of the Ubuntu version you have in use: Ubuntu 18.04 as Nico Haase was so nice to point out.
That is indeed a not supported Ubuntu release, so you have no fun with that PPA for it.
As Lech Sandecki wrote in Mar 2023:
Ubuntu 18.04 LTS ‘Bionic Beaver‘, one of the most popular Ubuntu releases, will reach the end of the standard, five-year maintenance window for Long-Term Support (LTS) releases on 31 May 2023.
It's now time to open the fish can, take care you're well seated.
FROM phusion/baseimage:bionic-1.0.0-amd64
This fishing trawler was last pushed Jun 4, 2020 at 11:05 am. It's only three years, but still not quite the fresh breeze it's blowing right there at the seaside.
There's another one just a year old, but more importantly from a supported Ubuntu version for the PPA you have selected: phusion/baseimage:jammy-1.0.1.
And while testing this for you, see:
#6 13.22 PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
That guy you can thank you because it will help you to get your PHP 7.3 code back running.
This is how I tested ($ is the prompt):
$ <<DOCKER docker build --progress=plain --rm -
FROM phusion/baseimage:jammy-1.0.1
RUN set -x ; \
uname -a ; \
cat /etc/lsb-release ; \
:
RUN set -x ; \
locale-gen en_US.UTF-8 ru_RU.UTF-8 ; \
add-apt-repository ppa:ondrej/php ; \
apt-get install -y --no-install-recommends php7.3-cli ; \
:
RUN set -x ; \
php --version ; \
:
DOCKER
(Docker version 24.0.5, build ced0996 / github.com/docker/buildx v0.11.2 9872040)
Some results:
...
#4 [1/3] FROM docker.io/phusion/baseimage:jammy-1.0.1@sha256:7faf4efcd96870fe090d969703ef8e727cc9de4f465c8442047ffd26f8094e6b
...
#5 [2/3] RUN set -x ; uname -a ; cat /etc/lsb-release ; :
#5 0.333 + uname -a
#5 0.334 Linux buildkitsandbox 5.15.0-78-generic #85-Ubuntu SMP Fri Jul 7 15:25:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
#5 0.334 + cat /etc/lsb-release
#5 0.335 DISTRIB_ID=Ubuntu
#5 0.335 DISTRIB_RELEASE=22.04
#5 0.335 DISTRIB_CODENAME=jammy
#5 0.335 DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
#5 0.335 + :
...
That's a supported Ubuntu version.
...
#8 [4/4] RUN set -x ; php --version ; :
#8 0.604 + php --version
#8 0.615 PHP 7.3.33-11+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Jun 8 2023 15:22:14) ( NTS )
#8 0.615 Copyright (c) 1997-2018 The PHP Group
#8 0.615 Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
#8 0.615 with Zend OPcache v7.3.33-11+ubuntu22.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
...
And like magic it works as announced.
The important part is to upgrade in steps.
Upvotes: 5