How to resolve errors like “Call to undefined function mb_detect_encoding()”

While importing or exporting products using CSV, you may have encountered errors like Call to undefined function mb_detect_encoding(). This might be due to not enabling MBString in your server.

MBString is a non-default PHP extension. You must explicitly enable the module with the configure option. mb_detect_encoding() is a function under the MBString category.

The mb_detect_encoding() function ensures that the CSV file is in the UTF-8 encoded format which is the default character encoding format supported by our product import-export plugin.

In order to enable MBString support in your WHM/CPanel VPS you need to complete the following steps:

  1. Login to WHM as root
  2. Go to Software -> EasyApache
  3. If prompted to upgrade, do so then repeat step 2
  4. Begin customizing based on the current profile
  5. Proceed through the screens until you get to “Step 5”
  6. On “Step 5,” click on “Exhaustive Options”
  7. Under PHP, check the checkbox for MBString
  8. Proceed with Build & Compile Process
  9. Make sure you wait for the build to complete.

On the other hand, to enable the MBString library in Windows package installations, follow the below steps:

  1. Open the php.ini file found in the moodle/apache/bin folder or Windows folder
  2. Find the line ;extension=php_mbstring.dll
  3. Remove the semicolon ;  at the beginning of the line
  4. Restart Apache if necessary

One thought on “How to resolve errors like “Call to undefined function mb_detect_encoding()”

Leave a Reply

Your email address will not be published. Required fields are marked *