Enable php_mbstring in PHP
Issue
In the PHP code, using the mb_strlen
method, an error outputs as bellow.
Call to undefined function mb_strlen()
Solution
It needs to enable mbstring.
Linux/Unix
We can configure PHP again or add mbstring extension.
1. Configure PHP
When configure PHP, add --enable-mbstring
.
$ ./configure --prefix=/opt/php --enable-mbstring
$ make
$ sudo make install
2. Add mbstring extension
In PHP source folder.
$ cd ext/mbstring
$ ./configure --prefix=/opt/php-5.4.45 --with-php-config=/opt/php-5.4.45/bin/php-config
$ make
$ sudo make install
Edit php.ini
, add new line extension=mbstring.so
.
extension=mbstring.so
Windows
In php.ini
, remove the ;
symbol before extension=php_mbstring.dll
.
extension=php_mbstring.dll