0

I'm trying to install PHP but this error keep occurring and I don't know how to solve it. Can someone help me? error

❯ sudo apt-get install php
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: php : Depends: php8.1 but it is not going to be installed E: Unable to correct problems, you have held broken packages.

Edit:

❯ sudo apt update
Hit:1 https://dl.winehq.org/wine-builds/ubuntu focal InRelease
Hit:2 https://download.docker.com/linux/ubuntu focal InRelease                 
Get:3 https://deb.opera.com/opera-stable stable InRelease [2.590 B]            
Hit:4 https://repo.steampowered.com/steam stable InRelease                     
Hit:5 http://ppa.launchpad.net/lutris-team/lutris/ubuntu focal   InRelease       
Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]      
Hit:7 http://packages.microsoft.com/repos/code stable InRelease                
Hit:8 http://br.archive.ubuntu.com/ubuntu focal InRelease                      
Get:9 http://br.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]     
Hit:10 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease              
Get:11 http://security.ubuntu.com/ubuntu impish-security InRelease [110 kB]    
Get:12 http://br.archive.ubuntu.com/ubuntu focal-backports     InRelease [108 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/main amd64   DEP-11 Metadata [40,7 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [66,4 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2.464 B]
Get:16 http://security.ubuntu.com/ubuntu impish-security/main amd64 DEP-11 Metadata [20,2 kB]
Fetched 579 kB in 2s (257 kB/s)              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
188 packages can be upgraded. Run 'apt list --upgradable' to see them.

sudo apt upgrade Reading package lists... Done Building dependency tree
Reading state information... Done Calculating upgrade... Done The following packages have been kept back: bind9-dnsutils bind9-host bsdutils curl distro-info-data ghostscript-x libcurl4 libldb2 libnss-systemd libpam-systemd libpcre2-8-0 libreoffice-common libreoffice-help-common libreoffice-help-en-us libreoffice-help-pt libreoffice-help-pt-br libreoffice-l10n-pt libreoffice-l10n-pt-br libreoffice-style-tango libsystemd0 libsystemd0:i386 libtiff5 libudev1 libudev1:i386 libxml2 libxml2:i386 rsyslog systemd-sysv systemd-timesyncd thunderbird-gnome-support vim-common 0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded.

  • 1
    Thos suggests that your package management is broken. This needs to be sorted out before you can add new software. Can you edit your question with the output of both sudo apt update and sudo apt upgrade? – Nmath May 24 '22 at 03:13
  • Posted there @Nmath – Enzo Massaki May 24 '22 at 12:48
  • You have both impish and focal repos on your system, this is a guaranteed way to break the package system. Whichever version your system is supposed to be (you don't say), get rid of the other repos and all software installed from them. – Organic Marble May 24 '22 at 16:03
  • There are multiple problems with packages. Never try to add new software if these commands don't come back clean- it makes things worse. If you're on focal, you need to delete all of the impish sources. Never add sources from another release. Once this is done, you need to run the apt update/upgrade commands again. If you still have held/broken packages, you need to fix those. See the comment from @ArturMeinild. Remember that you always need to run sudo apt update before doing anything else in apt and you should always sudo apt upgrade before installing anything new. – Nmath May 24 '22 at 19:09

0 Answers0