[solved] Call to undefined function mb_strlen() error | WHM

Category : cPanel/WHM

The function mb_strlen() is not enabled by default in PHP.  So, in order to make it work let’s enable it.

We will fix “undefined function mb_strlen()” by installing phpXX-php-mbstring (XX here is PHP version) via WHM


  • WHM/cPanel on Server and its WHM Credentials


  1. Login to WHM and open main page of WHM where it shows various Sections
  2. Locate or Search “Software” Section and Open it
  3. Open “EasyApache 4” (or EasyApache 3 if you are still using it)
  4. Tap on Customize for Current Installed Packages ( With EA3, it can be bit different but a similar option will be present)
  5. After current package opens navigate to “PHP Extensions” menu in left pane and long list opens.
  6. In search bar, you have to search for mbstring
    Make sure you filter the PHP version you are using and need for particular PHP Version (In case you want to install for every user, then you can select all the PHP versions)
  7. Tick on Install option and make it as below image
  8. Now move to “Review” Section on Left Pane
  9. Under Green box, it will show that our php55-php-mbstring will be installed under current profile and we tap on Save Provision Option below the list.
  10. The installation progress starts and finishes successfully as the following image.
  11. Verify the extension by repeating Steps #2 to #6 and it should show blue dot and installed box right next to it like our image below.

So, with this, we have finished installing php55-php-mbstring which will eventually fix “undefined function mb_strlen()” error for users on that server. Using the same method we can Install and uninstall other PHP Extensions.

For LAMP setup users with PHP 7.0, a simple command will install the required missing extension :

sudo apt install php7.0-mbstring