Enabling Mbstring extension on a cPanel server – EasyApache
Yeah, Mbstring is missing on my PHP installation. How can I enable this?
Mbstring is a non default extension which means it is not enabled with the normal PHP installation by default. But you can enable this module by using the configure option along with the installation. More about Mbstring module.
In a WHM/cPanel server you can simply enable this module from the EasyApache script. This is the inbuilt script used for rebuilding Apache and PHP on the server. This can be done from the WHM panel and from the server CLI. I prefer server CLI (Command Line Interface) for EasyApache. Here I’m explaning the steps to enable the PHP module Mbstring via EasyApache script.
Make sure you’ve verified the current Apache and PHP version before starting the EasyApache script. Make a copy of current Apache (/usr/local/apache/conf/httpd.conf) and PHP (/usr/local/lib/php.ini) configuration files.
Here we go!!
Steps to enable Mbstring via EasyApache script – CLI
First of all, check this module is already enabled on server. You can use the following code to check this from CLI:
php -m | grep mbstring
1. SSH to server as root.
2. Create a screen session to execute the EasyApache.
screen -S name
3. Execute the EasyApache script.
3. If the script prompted with a cPanel update message, hit NO and continue.
4. Click on “Customise Profile“
5. Make sure you’ve selected the Apache and PHP version correctly as you required.
6. Now click on “Exhaustive Options List.”
7. Use down arrow until you see the Mbstring extension.
8. Select it.
9. Click on “Next Step” then “Save and build.”
1o. Now check it.
# php -m | grep mbstring mbstring
That’s it dude!!
This can also be done from the WHM panel, you can select it from “Home » Software.”
Let me know if you’ve any questions on this topic.