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:
- Login to WHM as root
- Go to Software -> EasyApache
- If prompted to upgrade, do so then repeat step 2
- Begin customizing based on the current profile
- Proceed through the screens until you get to “Step 5”
- On “Step 5,” click on “Exhaustive Options”
- Under PHP, check the checkbox for MBString
- Proceed with Build & Compile Process
- 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:
- Open the php.ini file found in the moodle/apache/bin folder or Windows folder
- Find the line ;extension=php_mbstring.dll
- Remove the semicolon ; at the beginning of the line
- Restart Apache if necessary