[solved] Call to undefined function mb_strlen() error | WHM
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
- Login to WHM and open main page of WHM where it shows various Sections
- Locate or Search “Software” Section and Open it
- Open “EasyApache 4” (or EasyApache 3 if you are still using it)
- Tap on Customize for Current Installed Packages ( With EA3, it can be bit different but a similar option will be present)
- After current package opens navigate to “PHP Extensions” menu in left pane and long list opens.
- 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)
- Tick on Install option and make it as below image
- Now move to “Review” Section on Left Pane
- 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.
- The installation progress starts and finishes successfully as the following image.
- 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