Score:13

Can' install php7.4 on ubuntu 22.10

mg flag

I've followed this tutorial to install php7.4 on Ubuntu 22.10.

As far as I know, I just need to add this PPA and update my repositories with

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

and then install php7.4 with

sudo apt-get instal php7.4

However, I'm getting this error:

nugroho@vostro:~$ sudo apt-get update
Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease
Ign:2 https://ppa.launchpadcontent.net/ondrej/php/ubuntu kinetic InRelease
Err:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu kinetic Release
  404  Not Found [IP: 185.125.190.52 443]
Hit:4 http://archive.ubuntu.com/ubuntu kinetic InRelease   
Get:5 http://archive.ubuntu.com/ubuntu kinetic-updates InRelease [90,7 kB]
Hit:6 http://archive.ubuntu.com/ubuntu kinetic-backports InRelease
Get:7 http://archive.ubuntu.com/ubuntu kinetic-security InRelease [90,7 kB]
Reading package lists... Done    
E: The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu kinetic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

and

nugroho@vostro:~$ sudo apt-get install php7.4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package php7.4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php7.4' has no installation candidate

Is php7.4 not yet supported on Ubuntu 22.10, or did I make a mistake?

Below are some details about my install:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.10
Release:    22.10
Codename:   kinetic
David avatar
cn flag
As Ubuntu 22.10 uses php 8 it is looking like you are trying to use an older version. Ubuntu does not allow for downgrading a version of an app. Other features of the OS may depends on the default version so you may corrupt the OS by trying to force a downgrade.
Ashok avatar
um flag
I think this is happening because the ppa:ondrej hasn't been updated for 22.10. I am looking for a solution as well.
in flag
If you need an older version of PHP, Docker containers are the way to go. You will always have the exact version you want to work with in that container, and the host system can be updated for security fixes and whatnot without affecting the Docker resources
Dede Nugroho avatar
mg flag
Yes, currently docker is the solution what i'm looking for, thank you :)
cg flag
Why do you need to do this? It might not be a very good idea, depending on your use case
Dede Nugroho avatar
mg flag
because i have some project written in php 7.4
Score:14
ng flag

I've followed the steps below and it worked out fine! (thanks to Item-alert reddit link)

i had the same problem after upgrading from 22.04 to 22.10 and php 5.6.(in my case php 7.4) I solved it by changing /etc/apt/sources.list.d/ondrej-ubuntu-php-kinetic.list.

deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main
#deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu/kinetic main

Of course, run the apt update command

Score:8
vn flag

There are a couple of elements at work here.

First, the PHP version follows Ubuntu by default. So any installation of PHP other than 8 on Ubuntu 22.10 is non-default.

One method is using the ppa:ondrej/php. However, the PPA needs to be updated for each distribution, which hasn't happened yet for 22.10.

Another option is to install PHP (and possibly Apache etc.) using containers. In this case, the PHP version can be independent from the system.

Any other manual installation of a non-default PHP version is not recommended, since it can cause package dependency issues in the long run.

Dede Nugroho avatar
mg flag
thank you for your answer, yep currently i'm using docker using it, and waiting for the next ppa packages update for this distribution :)
Charles Wood avatar
cl flag
I'm having the opposite problem, which is apparently that the PPA is now on Mantic (aka Ubuntu 23), and no longer has php7.4-mysql available :/
Score:2
fr flag

I solved the same problem by downloading and installing manually (using dpkg install) the libicu70 library from the Ubuntu packages https://packages.ubuntu.com/jammy/amd64/libicu70/download

Then sudo apt install php7.4-intl goes smoothly.

EDIT The dependency issue only appeared after the first step that I forgot to mention : using jammy instead of kinetic in ppa:ondrej/php as kinetic is not yet available from that PPA. (Note that this whole answer has a very short life expectancy.)

Dede Nugroho avatar
mg flag
Thank you for you answer, i've already try but it's still unable to install php7.4,this is how i do it `wget http://ftp.osuosl.org/pub/ubuntu/pool/main/i/icu/libicu70_70.1-2_amd64.deb` `sudo dpkg -i libicu70_70.1-2_amd64.deb` then i tried to install php7.4 but it's still unable to install it
Dede Nugroho avatar
mg flag
perhaps you can tell me how to do it ? many thanks
Emmanuel Guiton avatar
fr flag
I forgot to mention that, as Artur pointed out, kinetic is not yet available from ppa:ondrej/php. Thus I used `jammy` instead.
cg flag
Just because something is possible doesn't mean it's a good idea. If you can't use the version of PHP in the standard repos, I prefer the suggestion of using containerised PHP. Non-standard repos are more risky as they are less likely to be well maintained into the future and untrusted code is more likely to be included
Score:0
mq flag

php-fpm 7.4 via Docker method

You may wish to consider installing PHP 7.4 in a Docker container, while Apache runs in the host system.

I posted a full guide on Stack Overflow to cover the general (version-independent) steps necessary, but in this post I will focus on the specific considerations of using PHP 7.4 on Ubuntu 22.10 -- especially now that PHP considers 7.4 to be past end of life.

Rationale

I decided to go this route as I don't think the usual ppa:ondrej/php PPA will be updated to include 7.4. Per their website, "Only Supported Versions of PHP . . . Don't ask for end-of-life PHP versions." PHP 7.4 is now EOL, so we should not expect this PPA to be added.

Additionally, as others have mentioned in this thread already, mixing PPAs designed for different releases may result in future dependency errors.

Consideration: Updates

The official PHP 7.4 Docker image is no longer updated (based on the github for it), so don't use the php:7.4-fpm image in production (or any internet-facing usage) as-is. It should be reasonably safe in a localhost development environment, though.

Note -- Debian / Ubuntu will continue to receive PHP 7.4 updates for some time, even after PHP has already declared it EOL. It should be possible to set up a docker container based on Debian/Ubuntu's 7.4 php-fpm which should still be supported until 20.04 reaches EOL. There are 1,515 results for PHP7.4 on dockerhub, so there's a good chance someone is already doing this.

Also, if you go this route because you intend to deploy to production, you will also likely want to investigate automated build methods to keep the container updated. Though it's generally non-advisable to deploy a production web server on a non-LTS release.

Consideration: Tuning

It should also be noted that tuning settings or adding future plugins is cumbersome because it requires a full docker rebuild instead of just editing a config file or running a single apt command.

A possible workaround is that you could share the php-fpm config on a virtual host folder.

Next steps

Follow the main guide here for general instructions. Instead of using the official php:7.4-fpm package, you may wish to explore non-official images to mitigate the EOL issue.

MISSIRIA avatar
in flag
I had the same error and It's worked after changed the branch of php package from kinetic to jammy
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.