phpMyAdmin is a web based front end to MySQL written in PHP. It likes to have the mbstring extension loaded if using a multi byte character set and will display warnings when you first log into phpMyAdmin if it is not available. This post looks at the error message and how to install the mbstring extension for PHP on CentOS / Red Hat Enterprise Linux using yum.
phpMyAdmin mbstring error message
The error message that phpMyAdmin displays is as follows:
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.
Installing the PHP mbstring package
This means the mbstring PHP extension is not installed so you need to install it. Using the yum command line tool it is very easy to install the mbstring extension as shown below:
yum install php-mbstring
This will output something like this:
Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Package php-mbstring.i386 0:5.1.6-20.el5_2.1 set to be updated --> Running transaction check Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: php-mbstring i386 5.1.6-20.el5_2.1 updates 969 k Transaction Summary ============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 969 k Is this ok [y/N]:
At this stage you need to type in "y" and hit <enter>. The package will then install:
Downloading Packages: (1/1): php-mbstring-5.1.6 100% |=========================| 969 kB 00:57 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: php-mbstring ######################### [1/1] Installed: php-mbstring.i386 0:5.1.6-20.el5_2.1 Complete!
The PHP mbstring package is now installed and the error message in phpMyAdmin will no longer appear. You will need to restart Apache for the changes to take effect.
Searching for the mbstring package
Often you don’t actually know what the exact name of a package is, so although I’ve already shown how to install the PHP mbstring package above, this final section shows how to use yum to search for it in the first place.
It’s fairly likely that "mbstring" will be present in the package name, so you can search for it on the command line like so:
yum search mbstring
This will return this:
Loading "installonlyn" plugin Setting up repositories Reading repository metadata in from local files php-mbstring.i386 5.1.6-20.el5_2.1 updates Matched from: php-mbstring The php-mbstring package contains a dynamic shared object that will add support for multi-byte string handling to PHP. php-mbstring.i386 5.1.6-20.el5 base Matched from: php-mbstring The php-mbstring package contains a dynamic shared object that will add support for multi-byte string handling to PHP.
This shows us that the package is called "php-mbstring" and that it was available in the base distribution (the base keyword off to the right) and also as as an update (the updates keyword). The x86-64 version of CentOS would show php-mbstring.x86_64 as the name. When you go to install the package you omit the platform version at the end, so php-mbstring.i386 becomes simply php-mbstring