• Uncategorized

About php : Fatal-error-Call-to-undefined-function-mbsubstr

Question Detail

I wanted to see your input on this concern I’m currently experiencing.
It turns out that:

is somehow giving me an error on the site, the error shows:

Fatal error: Call to undefined function mb_substr() in /home/(website)/public_html/index.php on line 308

I don’t quite understand what they mean by mb_substr, is this a PHP version error?
I am currently using PHP 5.3.19

Question Answer

mb_substr() is a multibyte-safe version of substr(), meaning it works with characters as opposed to bytes. This is most noticeable in UTF-8, where many characters are represented by two or more bytes.

According to the installation instructions, mbstring is not a built-in extension. You must enable it by having the appropriate files and configuring PHP correctly. Some information can be found in the link provided, your webhost should be able to help you with the rest.

To see if mbstring is installed:
php -m | grep mbstring

For Linux, install using

sudo apt-get install php-mbstring
……………………………………………………
Throw this into a terminal:

php -m | grep mb

If mbstring shows up then it should work.
……………………………………………………
If you have root access, you can configure it using WHM Panel or using Command Line. I will let you know how you can do it using WHM Panel.
1. Login to your WHM with Root User
2. Go to Easyapache
3. Go to previously saved configuration
4. Click on Start Customizing based on Profile.
5. Don’t change apache and php version, just click next.
6. Click on Exhaustive options list at the bottom of php configuration
7. Select the checkbox near MBString option
8. Save and Build
9. Do not close your browser window if it takes a while. Be patient.
You are Done!!!
……………………………………………………
The error is telling you that you are trying to use a function named mb_substr that doesn’t exist.

Perhaps you can achieve the same result using the substr function http://php.net/manual/en/function.substr.php instead. substr(strip_tags($disc_t), 0, 10) will return the first ten characters of the result of strip_tags($disc_t) .

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.