Unable to install php-mbstring
59,706
Solution 1
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
Solution 2
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
Solution 3
All I had to do was
sudo apt-get update
and it was available for install after this.
Related videos on Youtube
Author by
Jonathan
Updated on September 18, 2022Comments
-
Jonathan over 1 year
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.
-
Jonathan over 5 yearsI have universe enabled and it did not help.
-
bradhancock over 5 yearsweird, can you post what you have in your sources.list?
-
Jonathan over 5 yearsI have changed my environment for reasons unrelated to this problem but as soon as I have apache2 and php installed I will try again and report.
-
jbobbins over 5 yearsIf you're like me you might be tempted to copy those lines and update and install and move on without knowing what those things mean. I'm not sure which switch(es) made it work, so that's a little frustrating--how do I find that out? If it was restricted or multiverse do I have to pay for it? I only had "main" originally in my sources.list file. I learned: restricted=not_free/canonical_supported. universe=free/not_supported. multiverse=not_free/not_supported. en.wikipedia.org/wiki/Ubuntu#Package_classification_and_support
-
Jorgeee over 5 yearsmbstring is only universe repositories so you need add multiverse, you can reach more information here: packages.ubuntu.com/bionic/php7.2-mbstring
-
Khai Nguyen almost 5 years@bradhancock The last lines on my sources.list file look like that
deb http://security.ubuntu.com/ubuntu bionic main universe # deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted deb http://security.ubuntu.com/ubuntu bionic-security main universe # deb-src http://security.ubuntu.com/ubuntu bionic-security universe deb http://security.ubuntu.com/ubuntu bionic-updates main universe # deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
-
Yazid Erman almost 4 yearsSame for PHP7.3, but with sudo apt-get install php7.3-mbstring