Upgrade PHP to 7.3 (unmet dependencies)

Hi, I ask you for your help:

I follow these instructions but when I execute:

sudo apt install php7.3

I found this:

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:
 php7.3 : Depends: libapache2-mod-php7.3 but it is not going to be installed or
                   php7.3-fpm but it is not going to be installed or
                   php7.3-cgi but it is not going to be installed
          Depends: php7.3-common but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

My PHP version

~# php --version
PHP 7.0.33-0ubuntu0.16.04.6 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-0ubuntu0.16.04.6, Copyright (c) 1999-2017, by Zend Technologies

Ubuntu version

~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

¿How can I upgrade PHP in this situation? I'm not an expert in linux.

Thank you.

5 Replies

Try sudo apt-get install aptitude
sudo aptitude install “package name”

Thank you, LouWestin
That's what I get:

:~# sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package aptitude 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 'aptitude' has no installation candidate

This is my /etc/apt/sources.list

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
# deb http://mirrors.linode.com/ubuntu/ bionic main restricted # disabled on upgrade to bionic
# deb-src http://mirrors.linode.com/ubuntu/ bionic main restricted # disabled on upgrade to bionic

## Major bug fix updates produced after the final release of the
## distribution.
# deb http://mirrors.linode.com/ubuntu/ xenial-updates main restricted # disabled on upgrade to bionic
# deb-src http://mirrors.linode.com/ubuntu/ xenial-updates main restricted # disabled on upgrade to bionic

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
# deb http://mirrors.linode.com/ubuntu/ bionic universe # disabled on upgrade to bionic
# deb-src http://mirrors.linode.com/ubuntu/ bionic universe # disabled on upgrade to bionic
# deb http://mirrors.linode.com/ubuntu/ xenial-updates universe # disabled on upgrade to bionic
# deb-src http://mirrors.linode.com/ubuntu/ xenial-updates universe # disabled on upgrade to bionic

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
# deb http://mirrors.linode.com/ubuntu/ bionic multiverse # disabled on upgrade to bionic
# deb-src http://mirrors.linode.com/ubuntu/ bionic multiverse # disabled on upgrade to bionic
# deb http://mirrors.linode.com/ubuntu/ xenial-updates multiverse # disabled on upgrade to bionic
# deb-src http://mirrors.linode.com/ubuntu/ xenial-updates multiverse # disabled on upgrade to bionic

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://mirrors.linode.com/ubuntu/ xenial-backports main restricted universe multiverse # disabled on upgrade to bionic
# deb-src http://mirrors.linode.com/ubuntu/ xenial-backports main restricted universe multiverse # disabled on upgrade to bionic

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
deb http://archive.ubuntu.com/ubuntu bionic universe

Ubuntu 18.04 LTS is called Bionic Beaver…or bionic for short.

You need to un-comment all the lines in /etc/apt/sources.list that reference bionic…and remove all the lines that reference

  • xenial (Ubuntu 16.04 LTS - Xenial Xerus) and
  • trusty (Ubuntu 14.04 LTS - Trusty Tahr)

The xenial & trusty lines are commented out anyway so removing them will clean up your file immensely…and reflect the true state of your system.

-- sw

P.S. If you're going to use libapache2-mod-php7.3, you can only use mpm-prefork…not any of the multi-threaded Apache MPMs. libapache2-mod-php7.3 is not multi-threaded and will crash your server horribly if you try to use it in a multi-threaded environment (I'm pretty sure that a2enmod/a2dismod prevent this combination anyway).

Thank you very much, stevewi.
You finally gave me the solution.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct