My site was working fine from last 2 3 months but now it shows 500 Server error message. Then I saw the error.log
file it says that
PHP Fatal error: Call to undefined function utf8_substr() in public_html/catalog/model/tool/image.php on line 11
And the code at the given location is:
$new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
Then I thought may be its because of cache and then I cleared the cache and still gets the same error message. I was looking for solution on google and I found few solution like Clearing cache
, Check if startup.php
or utf8.php
is missing or not but file is on the correct place. It is on production env and site is down from last two days.
Please tell me a solution for this problem.
I'm running Opencart version 2.0.3.1
Thanks in advance
Install php-mbstring, the only solution
Please check you have installed
mbstring
oriconv
PHP extension yet. Because this function just load when you installed one of them. This is code for your case https://github.com/opencart/opencart/blob/master/upload/system/helper/utf8.phpI found the solution. My site was missing
mbstring
extension.yum install mbstring
wasn't working on my server because it was namedea-php56-php-mbstring-5.6.26-1.1.2.cpanel.x86_64
. I installed this and my website is working again. If you are also having same problem. Then please ssh into your site and check if mbstring is installed you can check that by runningphp -m | grep mbstring
it will not return anything if mbstring is not installed but if extension is installed then it will return mbstring. Ifmbstring
is missing then You can run this commandyum search mbstring
it will search extentions withmbstring
word. Then run this commandyum install NAME_OF_FILE
. Replace NAME_OF_FILE with the name of thembstring
file. then follow instruction and once the installation is done. You can cross check ifmbstring
is installed by runningphp -m | grep mbstring
command. It was so helpful in my case. I'm sorry if I didn't explain it properly. Thank you tmquang6805