How to install PHP `mbstring` extension in Ubuntu?

EDIT: Dylan Pierce has confirmed that you can already install some PHP 7.2 extensions in the same way you would for PHP 5. For mbstring in particular, you can execute:

sudo apt-get install php7.2-mbstring

To complement sparkmood's answer, this now works for PHP 7.2 if you already imported ondrej's PPA for it.

sudo apt-get install libapache2-mod-php7.2

Don't forget, either PHP 7 is available through ubuntu's official repositories or you will need an external PPA.


sudo apt-get install php-mbstring

I have installed mbstring in php7.0-fpm (7.0.15-0ubuntu0.16.04.4)


mbstring is built in libapache2-mod-php5 package, so you can use this command for installing :

sudo apt-get install libapache2-mod-php5

As described in package details :

 dba dom ereg exif fileinfo filter ftp gettext hash iconv json libxml
 mbstring mhash openssl pcre Phar posix Reflection session shmop SimpleXML
 soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml
 xmlreader xmlwriter zip zlib.