Cannot install php-mbstring on ubuntu 18.04

11,885

Solution 1

Make sure you have the "universe" repository enabled for apt-get:

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"

Solution 2

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

Save and run:

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

And it's done

Source: https://askubuntu.com/questions/1064634/unable-to-install-php-mbstring

Share:
11,885

Related videos on Youtube

Bùi Ngọc Minh
Author by

Bùi Ngọc Minh

Updated on June 04, 2022

Comments

  • Bùi Ngọc Minh
    Bùi Ngọc Minh almost 2 years

    I'm using ubuntu 18.04. I'm trying to install mbstring but terminall show error:

    php-mbstring : Depends: php7.2-mbstring but it is not going to be installed
    

    So I' trying to install php7.2-mbstring but error again:

    php7.2-mbstring : Depends: php7.2-common (= 7.2.3-1ubuntu1) but 7.2.7-0ubuntu0.18.04.2 is to be installed
    

    Sorry for my bad english. Anyone have idea how to fix this :(

    • Nico Haase
      Nico Haase almost 6 years
      So, what about installing the packages in question? What exactly is the problem with that?
    • Bùi Ngọc Minh
      Bùi Ngọc Minh almost 6 years
      I ran composer install in laravel project and it showed error: the requested PHP extension mbstring is missing from your system. @NicoHaase
    • Nico Haase
      Nico Haase almost 6 years
      On which architecture do you use your system? According to packages.ubuntu.com/bionic/php7.2-mbstring, the extension depends on 7.2.7 for amd64 and i386, while other architectures only provide 7.2.3 so far...
    • Micheal Shallop
      Micheal Shallop over 5 years
      php 7.2.7 on a clean 18.04 install (apt install php) -- attempting to install mbstring fails with unable-to-locate error. Confirmed that it was listed as a package... if a dependency was missing, you'd get a completely different error...