The function mb_strlen() is not enabled by default in PHP. Please read the manual for installation details:
http://www.php.net/manual/en/mbstring.installation.php
Answer from AJ. on Stack Overflowcompilation - PHP: Call to undefined function mb_strlen() - on custom compiled PHP with mbstring enabled - Stack Overflow
Support - Share not working: PHP Fatal error: Call to undefined function mb_strlen() - Mahara ePortfolio System
yii2 - Call to undefined function mb_strlen() on PHP 7 Ubuntu 14.04 - Stack Overflow
Fatal error: Call to undefined function mb_strlen
For PHP 4.3.3 or before, To enable that feature, you will have to supply either one of the following options to the LANG parameter of --enable-mbstring=LANG ; --enable-mbstring=cn for Simplified Chinese support, --enable-mbstring=tw for Traditional Chinese support, --enable-mbstring=kr for Korean support, --enable-mbstring=ru for Russian support, and --enable-mbstring=ja for Japanese support (default). To enable all supported encoding, use --enable-mbstring=all
try
configure again with
--enable-mbstringonlygrep mb_strlen $PATH_TO_YOUR_PHP_BINARYto see is it exist
On my Windows system with PHP and Apache, I had to modify the PHP.INI file so that it includes the following line:
extension=php_mbstring.dll
(inside the main [PHP] section) and restart Apache. After that, the call to mb_strlen did succeed.
The error is a bit of a red herring since mb_strlen() is actually part of the mbstring php extension and not a function in yii2.
In php5 mbstring was part of libapache2-mod-php5.
It seems to be missing from libapache2-mod-php7. To fix this install the php7.x-mbstring package where x is your version:
sudo apt install php7.x-mbstring
You may need to restart Apache after this install.
For PHP7.1
Debian flavours
sudo apt-get install php7.1-mbstring
RedHat flavours
sudo yum install php7.1-mbstring
CLI configuration is separate from web configuration. Depending on your environment you have to change the php.ini file that is being used when PHP is accessed via whatever web server you use.
In order to check what is the location of the php.ini file in use, you can run phpinfo() from your web app (not CLI). The phpinfo() output will have information of php.ini file location.
So everything points to it being installed and working, but it was still giving the error. I even verified the mbstring.so actually exists where it should be and is in the php.ini and not commented.
I tried to install it but got 'nothing to do' since its already there.
What I did to fix this is uninstall mbstring then install it again from opencsw (where I install all my php packages from).
After doing that and restarting apache again, it is no longer giving me the error.