Ensure that PHP is compiled with php_mbstring.dll enabled
Question
I'm currently experiencing error on my application using php. here is the error message
Error - mPDF requires mb_string functions. Ensure that PHP is compiled with php_mbstring.dll enabled.
I'm using third party library to generate pdf file (MPDF). It works fine on my loaclhost (windows) but when we deploy it on the linux server, it throws the above error.
Can anyone help me on what's going on and how could I fix it. It seems that the php_mbstring.dll is missing on our linux server configuration.
Solution
if (!function_exists("mb_check_encoding")) {
die('mbstring extension is not enabled');
}
And if you get that error, then rebuild PHP from source with mbstring enabled, or apt-get to include it in the build
OTHER TIPS
I was having the same problem on CentOS Linux. "yum install php-mbstring.x86_64" fixed it for me
On Debian or Ubuntu, the mbstring package is not pulled in by default when you install php. You can fix this mPDF error with:
apt install php-mbstring
Find your php.ini, uncomment the line with the extension, and restart the server
Edit php.ini and extension=php_mbstring.dll
remove the ;
after which run the following commands
For php7.0
sudo apt-get install php7.0-mbstring
For php5.6
sudo apt-get install php5.6-mbstring
worked for me :)