Mbstring extension php

We are going to discuss the procedure to enable mbstring PHP extension for all PHP versions in cPanel/WHM.

In this tutorial, we will learn the following:

#1. How to Enable mbstring PHP extension in WHM?

To enable PHP extension in WHM, follow the below mentioned steps.

  • Login to WHM as root.
  • Navigate to Software section and then select EasyApache4 from the list. You can search easyin search bar and directly directed to same.
    Mbstring extension php
  • On the next page, go to Currently Installed Packages and click over Customize.
    Mbstring extension php
  • List of multiple options will appear on the next page. Scroll down to PHP Extensions and type mbstringin the search bar. Refer to the below given image.
    Mbstring extension php
  • List of all mbstringextension will appear. Scroll the button given next to PHP version which you want to enable and then Next.
    Mbstring extension php
  • You will be directed to next step and see a message: Preparing selected packages for review....
  • Review all the changes and then click over Provision and proceed.
    Mbstring extension php
  • A message appears : Provision process started, which will take few minutes to complete.
  • As the procedure completes, a message appears: Provision process is complete.
    Mbstring extension php

Thus, the above mentioned steps will help you to enable mbstring extension for all php versions.

#2. How to Install mbstring Extension from SSH?

You can install mbstring extension from command line by using the commands mentioned below.

  • For Ubuntu Linux server, run the following command.
apt-get install php7.4-mbstring
  • For CentOS Linux server, execute the below given command.
yum install php-mbstring

*If your server already have mbstring extension installed, then you will see the message, that says Error:Nothing to do.

That’s It !

Hope the article better describes the procedure to enable mbstring PHP extension for all PHP versions in cPanel/WHM”. Do share it with your colleagues if you find it working. Also share your suggestions and drop your queries to start the discussion on the related topic. Lets connect on social media with the below links.

Facebook Page: https://facebook.com/redserverhost                                                                                       Twitter Page: https://twitter.com/redserverhost.com

When running phpMyAdmin, you may see an error that says the mbstring extension is missing as follows:

PHP missing mbstring errorPHP missing mbstring error

This error prevents you from opening phpMyAdmin and accessing your database.

To solve this error, you need to have mbstring installed and activated in your PHP configuration.

Depending on your Operating System, there are different ways to install and enable the mbstring extension:

Install mbstring for Linux

For Linux systems, you can install mbstring using

# install mbstring v8.1
sudo apt-get install php8.1-mbstring

# install mbstring v7.4
sudo apt-get install php7.4-mbstring
1 or
# install mbstring v8.1
sudo apt-get install php8.1-mbstring

# install mbstring v7.4
sudo apt-get install php7.4-mbstring
2 depending on your Linux distribution.

Here’s the command to install mbstring for Debian / Ubuntu or Red Hat Linux:

sudo apt-get install php-mbstring

# for RHL:
sudo yum install php-mbstring

The package manager should install the right mbstring version based on your PHP version.

If not, you need to specify the version as follows:

# install mbstring v8.1
sudo apt-get install php8.1-mbstring

# install mbstring v7.4
sudo apt-get install php7.4-mbstring

Once the extenson is installed, you need to restart your PHP server.

For Apache, run the following command:

service httpd restart

Now you can check if the mbstring extension is enabled by running to see the mbstring enabled:

phpinfo() showing mbstring detailphpinfo() showing mbstring detail

You can also run the

# install mbstring v8.1
sudo apt-get install php8.1-mbstring

# install mbstring v7.4
sudo apt-get install php7.4-mbstring
7 command to see the extension from the command line:

$ php -m | grep mbstring
mbstring

Now that the mbstring extension is available, you should be able to access phpMyAdmin.

Install mbstring for Windows

For Windows system, you need to enable the mbstring extension from the

service httpd restart
0 file.

Look for the line

service httpd restart
1 in your
service httpd restart
0 file as follows:

;extension=php_mssql.dll
;extension=php_mbstring.dll
;extension=php_exif.dll  
extension=php_mysql.dll

You need to remove the semicolon before the

service httpd restart
3 config to enable
service httpd restart
4 for Windows.

;extension=php_mssql.dll
extension=php_mbstring.dll
;extension=php_exif.dll  
extension=php_mysql.dll

Once you enable the extension, restart your PHP server. The mbstring extension should now be available on your Windows computer.

If that doesn’t work, search your

service httpd restart
0 file for the
service httpd restart
6 config.

You should see where PHP look for the extensions as shown below:

extension_dir = "D:\XAMPP\php\ext"

You need to see if the

service httpd restart
4 exists inside the
service httpd restart
8 path. Copy the extension directory value and paste it to your explorer windows.

If the

service httpd restart
9 file is not present, you need to download the PHP Windows build from windows.php.net as shown below:

Download PHP Windows distributionDownload PHP Windows distribution

Extract the downloaded zip file, then look for the

service httpd restart
4 file from the
$ php -m | grep mbstring
mbstring
1 folder. Copy the file to your
service httpd restart
6 path.

I don’t recommend downloading dll files from the Internet because you may get a virus on your computer.

Restart your PHP server, and now the mbstring extension should be available.

And that’s how you enable mbstring on Windows computers.

Install mbstring for macOS

For macOS, the PHP formula from Homebrew already enabled the mbstring extension during the installation process.

What is Mbstring PHP extension?

Mbstring is an extension of php used to manage non-ASCII strings. Mbstring is used to convert strings to different encodings. Multibyte character encoding schemes are used to express more than 256 characters in the regular byte wise coding system.

How to enable PHP's Mbstring extension?

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..

How to check if Mbstring is enabled in PHP?

You can check it through phpinfo(). Search for the string "mbstring" in phpinfo page. If it is present means then mbstring is enabled or it is disabled.