The mbstring.func_overload directive in PHP replaces standard string functions with multibyte-safe versions, ensuring proper handling of non-ASCII characters (like UTF-8, Japanese, Cyrillic, etc.).
Important: This setting is deprecated since PHP 7.2 and removed in PHP 8.0. If you are running PHP 7.2+, you should remove it from your configuration.
What Does mbstring.func_overload Do?
When enabled, PHP replaces standard functions (e.g., strlen(), strpos(), substr()) with their mbstring equivalents (mb_strlen(), mb_strpos(), mb_substr()).
Example Behavior
| Standard Function | Overloaded Equivalent |
|---|---|
| strlen() > Returns byte length | mb_strlen() > Returns character length |
| substr() > Cuts bytes | mb_substr() > Cuts characters |
Helps handle UTF-8 text correctly, avoiding issues where multi-byte characters get cut off incorrectly.
Checking mbstring.func_overload Value
Method 1: Use phpinfo()
- Create a new PHP file (info.php):
- Open the file in a browser (http://yourdomain.com/info.php).
- Search for "mbstring.func_overload" in the output.
phpinfo();
?>
Method 2: Check via CLI
Run this command in the terminal:
If it returns mbstring.func_overload => 0, it is disabled.
Enabling or Disabling mbstring.func_overload
Modify php.ini
Edit your PHP configuration file (php.ini):
Locate the line:
Change it to:
Save and restart Apache or PHP-FPM:
Disable mbstring.func_overload for PHP 7.2+
If you are using PHP 7.2+ or PHP 8, remove this line from php.ini:
Why?
- mbstring.func_overload is deprecated in PHP 7.2 and removed in PHP 8.0.
- Keeping it enabled may cause errors like:
- Instead, manually replace strlen() with mb_strlen(), substr() with mb_substr(), etc.
Alternative: Using Multibyte Functions Directly
If mbstring.func_overload is removed (PHP 8.0+), you should replace standard functions manually:
Before (mbstring.func_overload enabled)
echo substr("Привет", 0, 3); // Cuts characters incorrectly
After (Using Multibyte Functions)
echo mb_substr("Привет", 0, 3, "UTF-8"); // Correct substring handling
Common Issues & Fixes
| Issue | Solution |
|---|---|
| Deprecated warning in PHP 7.2+ | Remove mbstring.func_overload from php.ini. |
| String functions behaving strangely | Ensure correct use of mb_* functions. |
| Still getting errors after removal? | Restart Apache or PHP-FPM. |
| Encoding issues in scripts? | Set mb_internal_encoding("UTF-8"); in scripts. |
- mbstring.func_overload was useful for handling multibyte characters but is deprecated in PHP 7.2+ and removed in PHP 8.0+.
- If using PHP 7.2 or later, remove it and manually replace string functions with mb_* equivalents.
- If using older PHP versions, enable it in php.ini but be prepared to migrate your code.


