How do I install php mbstring extension in to Nginx Ubuntu

n01 picture n01 · Feb 27, 2015 · Viewed 36.6k times · Source

I need this php extension in order to use one of my Magento extension. How do I install php mbstring extension to my Nginx Ubuntu 14.04?

Answer

Ajeet Shah picture Ajeet Shah · May 3, 2016

STEP 1 - Installing mbstring

PHP mbstring extension is not enabled by default as stated in PHP docs. Try these:

PHP 5:

sudo apt-get install php5-mbstring

PHP 7:

sudo apt-get install php7.0-mbstring

Now you should see mbstring as enabled in a file with below code (check above FelixEve's answer):

<?php echo phpinfo(); ?>

You might need to use the right extension name for your PHP version:

For example:

  • for PHP 5.6: sudo apt-get install php5.6-mbstring
  • for PHP 7.1: sudo apt-get install php7.1-mbstring

STEP 2 - Restart you server:

After the installation of mbstring, you may need to restart your server (apache2 / nginx etc). Just use the following command.

sudo service apache2 restart
or
sudo service nginx restart