0 votes
61 views
by (1.3k points)
PHP Fatal error:  Uncaught Error: Call to undefined function utf8_substr() in /home/username/public_html/example.com/catalog/model/tool/image.php:11

1 Answer

0 votes
by (9.9k points)

Just insure your PHP has extension mbstring has installed and enabled. If you are using cPanel then you can enable it easily.

  1. cPanel > Software > Select PHP Version
  2. Select checkbox belong to mbstring
    cPanel > Software > Select PHP Version > mbstring
  3. Done..!

Now try to refresh affected website or page. If it still not worked then check your .htaccess. It might forcing your website to use another version of PHP having no mbstring enabled.

How to find PHP version script in .htaccess?

Generally, you can find the lines like below

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

So, as shown above script, it forcing your OpenCart website to use PHP 7.2 nevertheless what you chooses default version of PHP in cPanel. So, we need to remove these lines. But remember, you should backup this .htaccess file before implementing changes. 

Moreover, still one another player also possibly affect the website's behavior by making them to use another PHP version than cPanel's default version. It's none other than php.ini. Most time .htaccess and php.ini are in hidden state. So, even you not seen these files in your file manager then it does not mean these files are not exist. You should enable show hidden files from file manager's setting (from gear icon located upper right corner of file manager). 

If you found php.ini in the root directory of website (where generally .htaccess located) then search for lines like below

AddHandler application/x-httpd-php56 .php

This line forcing your website to use PHP 5.6 version, which might lack mbstring function. You can take backup of php.ini and then delete it. Now retry the website loading. 

Last but not least, verify if there is file named .user.ini. Because this file also change the PHP selection behavior. The line like

session.save_path = "/var/cpanel/php/sessions/ea-php73"

makes the website to use different PHP version. It's better to modify files with current version or backup & delete it. Then retest the website. All the best.

Welcome to DoubtSolver Q&A, where you can ask doubts and receive solutions from other members of the community.

Categories

...