Install PHP-mbstring

2018-07-31 09:29:14    Jon    36447

About mbstring

Each language has its own encoding and the number of bytes is different. mbstring extension is to ensure that different coded languages in PHP program can be displayed properly.


FAQ

1. When executing phpMyAdmin, an error message shows,
"The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results." Or

2. When using the application, an error message shows,
"Uncaught Error: Call to undefined function mb_strlen();"

Both are due to your PHP did not install mbstring.

Install mbstring

Linux


1. CenOS

php installation package path: /data/php5.6.14/
PHP installation path: /usr/local/php/


(Set the path according to your actual situation. Below is an example)

Find the directory of mbstring in PHP installation package.
cd /data/php5.6.14/ext/mbstring/

Execute phpize
/usr/local/php/bin/phpize


Compile and install
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install



Now mbstring.so is generated in  /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/



Add the code below to php.ini


extension=mbstring.so



Restart PHP and check whether PHP-curl is installed using phpinfo()


2. Ubuntu

sudo apt-get install php5.6-mbstring

Add extension=php5.6-mbstring.so to the configuration file.


Restart Ubuntu and it should work.


Windows


Alter php.ini
Remove ";" from ; extension=php_mbstring.dll . If there is no such code, add extension=php_mbstring.dll

If not working after restarting your web server, copy php_mbstring.dll  in your PHP folder to C:\WINDOWS\system32.

Restart it and it should work.
ZSite8.0