I could not install php8.3 on the ubuntu 22.04, wrong ppa path

22.04aptPHP

I recently tried to install the latest version of PHP which is 8.3.6 but before i purged php8.3.4 which i had before, now when I try in run

sudo apt install php -y

it says:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libapache2-mod-php8.3 php8.3 php8.3-cli php8.3-common php8.3-opcache php8.3-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  libapache2-mod-php8.3 php php8.3 php8.3-cli php8.3-common php8.3-opcache php8.3-readline
0 upgraded, 7 newly installed, 0 to remove and 4 not upgraded.
Need to get 4,923 kB/4,959 kB of archives.
After this operation, 22.3 MB of additional disk space will be used.
Err:1 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-common amd64 8.3.4-1+ubuntu22.04.1+deb.sury.org+1
  404  Not Found [IP: 185.125.190.80 443]
Err:2 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-opcache amd64 8.3.4-1+ubuntu22.04.1+deb.sury.org+1
  404  Not Found [IP: 185.125.190.80 443]
Err:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-readline amd64 8.3.4-1+ubuntu22.04.1+deb.sury.org+1
  404  Not Found [IP: 185.125.190.80 443]
Err:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-cli amd64 8.3.4-1+ubuntu22.04.1+deb.sury.org+1
  404  Not Found [IP: 185.125.190.80 443]
Err:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 libapache2-mod-php8.3 amd64 8.3.4-1+ubuntu22.04.1+deb.sury.org+1
  404  Not Found [IP: 185.125.190.80 443]
E: Failed to fetch https://ppa.launchpadcontent.net/ondrej/php/ubuntu/pool/main/p/php8.3/php8.3-common_8.3.4-1%2bubuntu22.04.1%2bdeb.sury.org%2b1_amd64.deb  404  Not Found [IP: 185.125.190.80 443]
E: Failed to fetch https://ppa.launchpadcontent.net/ondrej/php/ubuntu/pool/main/p/php8.3/php8.3-opcache_8.3.4-1%2bubuntu22.04.1%2bdeb.sury.org%2b1_amd64.deb  404  Not Found [IP: 185.125.190.80 443]
E: Failed to fetch https://ppa.launchpadcontent.net/ondrej/php/ubuntu/pool/main/p/php8.3/php8.3-readline_8.3.4-1%2bubuntu22.04.1%2bdeb.sury.org%2b1_amd64.deb  404  Not Found [IP: 185.125.190.80 443]
E: Failed to fetch https://ppa.launchpadcontent.net/ondrej/php/ubuntu/pool/main/p/php8.3/php8.3-cli_8.3.4-1%2bubuntu22.04.1%2bdeb.sury.org%2b1_amd64.deb  404  Not Found [IP: 185.125.190.80 443]
E: Failed to fetch https://ppa.launchpadcontent.net/ondrej/php/ubuntu/pool/main/p/php8.3/libapache2-mod-php8.3_8.3.4-1%2bubuntu22.04.1%2bdeb.sury.org%2b1_amd64.deb  404  Not Found [IP: 185.125.190.80 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Unfortunately, I tried all commands such –fix-missing, apt update, upgrade, everything works great except for php.

Thank you in advance.

This is the result of

sudo apt update

Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu jammy InRelease                                                                                            
Hit:3 http://dz.archive.ubuntu.com/ubuntu jammy InRelease                                                                                            
Hit:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease                                                    
Get:5 https://download.docker.com/linux/ubuntu groovy InRelease [43.3 kB]                                                   
Hit:6 https://ppa.launchpadcontent.net/linuxuprising/java/ubuntu jammy InRelease                                                        
Get:7 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]                            
Hit:8 http://dz.archive.ubuntu.com/ubuntu jammy-updates InRelease                       
Hit:9 http://dz.archive.ubuntu.com/ubuntu jammy-backports InRelease                        
Get:10 http://us.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]               
Hit:12 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease                  
Hit:11 https://packages.emqx.com/emqx/emqx/ubuntu jammy InRelease                     
Fetched 272 kB in 3s (98.7 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.

Thank you.

This is the result of:

sudo apt upgrade

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  gsasl-common node-ip libavdevice58 ffmpeg libpostproc55 libswscale-dev
  libgsasl7 libavcodec58 traceroute libavutil56 libswscale5 libavutil-dev
  libswresample3 libavformat58 libavformat-dev libavcodec-dev
  libswresample-dev libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages have been kept back:
  distro-info-data python3-update-manager update-manager update-manager-core
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

Thank you

Best Answer

Removing the PPA and reinstalling it again should fix the issue as the 404 error indicates that whatever version of the PPA that was installed no longer exists.

  1. Let's try removing the offending PPA: sudo add-apt-repository --remove ppa:ondrej/php
  2. Resync all repositories:sudo apt update
  3. Upgrade held packages:sudo apt install distro-info-data python3-update-manager update-manager update-manager-core
  4. Now upgrade:sudo apt upgrade
  5. Reinstall the PPA:sudo add-apt-repository ppa:ondrej/php
  6. Resync the repositories again:sudo apt update

This should update the IP Address for the PPA.

Related Question