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
The PPA description requires reading:
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:
It's now time to open the fish can, take care you're well seated.
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:
That guy you can thank you because it will help you to get your PHP 7.3 code back running.
Testing
This is how I tested ($ is the prompt):
(Docker version 24.0.5, build ced0996 / github.com/docker/buildx v0.11.2 9872040)
Some results:
That's a supported Ubuntu version.
And like magic it works as announced.
Next Steps
The important part is to upgrade in steps.