Unable to locate package php7 4 mbstring

I am attempting to install php-mbstring on a Ubuntu 18.04 server which already has apache2, php and mariadb installed. I have tried with the following sequence of commands:

jonathan@samuel:~$ sudo apt update
[sudo] password for jonathan:
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://downloads.mariadb.com/MariaDB/mariadb-10.3/repo/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Ign:4 http://downloads.mariadb.com/MaxScale/2.2/ubuntu bionic InRelease
Hit:5 http://downloads.mariadb.com/Tools/ubuntu bionic InRelease
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:7 http://downloads.mariadb.com/MaxScale/2.2/ubuntu bionic Release
Fetched 172 kB in 2s (91.6 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
jonathan@samuel:~$ sudo apt install php-mbstring
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-mbstring : Depends: php7.2-mbstring but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
jonathan@samuel:~$ sudo apt -f install php7.2-mbstring
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.2-mbstring : Depends: php7.2-common (= 7.2.3-1ubuntu1) but 7.2.7-0ubuntu0.18.04.2 is to be installed
E: Unable to correct problems, you have held broken packages.

It appears that there is an unresolveable dependency involved. How can I correct the situation? This problem is blocking my attempt to install phpMyAdmin.

Unable to locate package php7 4 mbstring

karel

103k86 gold badges254 silver badges285 bronze badges

asked Aug 12, 2018 at 11:53

0

I had to enable universe in my sources.list

sudo vi /etc/apt/sources.list

change the file to look like this:

deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe

updated apt-get

sudo apt update

And then I could install php7.2-mbstring

answered Aug 12, 2018 at 16:29

4

I had the same trouble in Ubuntu 18.04 #Edit the file /etc/apt/sources.list with the next lines:

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

#PHP 7.2 -> Save and run:

sudo apt update && sudo apt-get upgrade
sudo apt-get install php7.2-mbstring

#PHP 7.3 -> Save and run:

sudo apt update && sudo apt-get upgrade
sudo apt-get install php7.3-mbstring

And it's done

answered Sep 10, 2018 at 22:16

JorgeeeJorgeee

2834 silver badges10 bronze badges

3

All I had to do was

sudo apt-get update

and it was available for install after this.

answered Feb 3, 2021 at 13:30

Unable to locate package php7 4 mbstring

Simply Use:

sudo apt-get install php-mbstring

Then you must restart Apache Service, Use:

sudo service apache2 restart

answered Aug 17, 2019 at 1:44

Unable to locate package php7 4 mbstring

Try this I had the same issue for php8.0 in ubuntu 18.04

This will remove (all php7.0, 7.1, 7.2 etc)

sudo apt-get purge php7.*
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt upgrade
sudo apt install php-mbstring

answered Feb 26, 2021 at 13:21

Unable to locate package php7 4 mbstring