How to install and enable mbstring in PHP

It is necessary to have PHP enabled with mbstring (multi-byte string) support to store and display multi-byte characters in the PHPKB software. ABCD requires that you have PHP enabled with mbstring support. If not enabled, see the tutorial below on how to enable mbstring on your server.

If this extension is missing, the system displays the error message:

Fatal error: Uncaught Error: Call to undefined function mb_detect_order()

Why mbstring is required?

When we manipulate (trim, split, splice, etc.) strings encoded in a multi-byte encoding, we need to use special functions since two or more consecutive bytes may represent a single character in such encoding schemes. Otherwise, if we apply a non-multibyte-aware string function to the string, it probably fails to detect the beginning or end of the multibyte character and ends up with a corrupted garbage string that most likely loses its original meaning.

So, mbstring provides multibyte-specific string functions that help us deal with multibyte encodings in PHP. In addition to that, mbstring handles character encoding conversion between the possible encoding pairs. mbstring is designed to handle Unicode-based encodings such as UTF-8 and UCS-2 and many single-byte encodings for convenience.

MBstring Installation

Debian (Ubuntu, LinuxMint…)

sudo apt-get update
sudo apt-get install php-mbstring
sudo service apache2 restart

Red-Hat (RHEL, Fedora, CentOS, Mandriva…)

php -m
yum install php-mbstring
service httpd restart

MS Windows

If you have access to the php.ini, just remove the semicolon character (;) in front of the line below.

extension = php_mbstring.dll

Leave a Reply

Your email address will not be published. Required fields are marked *