Enabling Mbstring extension on a cPanel server – EasyApache

Mbstring extension is missing on my PHP installation. How can I enable it?

Mbstring is a non default extension, which means it won’t enabled with the normal PHP installation by default. But you can enable this module by using the configure option along with the installation process. More about Mbstring module.

In a WHM/cPanel server you can simply enable this module by using the EasyApache script. This is the inbuilt script used for rebuilding Apache and PHP on the server.

This can simply be done from the WHM panel or from the server CLI (Command Line Interface). I prefer server CLI for EasyApache. Here I’m explaining the steps to enable the PHP module Mbstring via EasyApache script.

Make sure you’ve verified the current Apache and PHP version before starting the EasyApache script. Make a copy of current Apache (/usr/local/apache/conf/httpd.conf) and PHP (/usr/local/lib/php.ini) configuration files.

Here we go!

Steps to enable Mbstring via EasyApache script – CLI

First of all, check this module is already enabled on server. You can use the following code to check this from CLI:

php -m | grep mbstring

cPanel updated their EasyApache script from EasyApache3 to EasyApache4 in their latest software version. And the script EasyApache 3 will stop soon. Here I am going to explain the installation of Mbstring using EasyApache 3 and EasyApache 4.

Dear Arunlal Ashok, My confusion is this:
On my local machine (php 5.5.12, apache 2.4.9) using WAMP, I install the php_mbstring extension and enable it by uncommenting its entry in php.ini. (this resolves a problem that arises when installing drupal 8)

On CentOS using cpanel, when I install the mbstring extension, I still get the error. I’m wondering if wondering if I should do the same to some php.ini file on the server. Does easyapache install and enable it automatically, or one has to uncomment an entry?

On a CentOS 6 cPanel server, you can enable this from the EA itself. Please check the server has CloudLinux, if so you need to remove the entry from php.ini and need to enable it from cPanel → PHP selector.