Reputation: 103
I have an error occurred when i try run my project at the server.
It could not defined mb_strlen() in /var/www/html/amhadm/vendor/yiisoft/yii2/helpers/BaseStringHelper.php
Here is my code in BaseStringHelper.php
public static function basename($path, $suffix = '')
{
if (($len = mb_strlen($suffix)) > 0 && mb_substr($path, -$len) == $suffix) {
$path = mb_substr($path, 0, -$len);
}
$path = rtrim(str_replace('\\', '/', $path), '/\\');
if (($pos = mb_strrpos($path, '/')) !== false) {
return mb_substr($path, $pos + 1);
}
return $path;
}
Can someone guide me how to solve this problem ?
Upvotes: 1
Views: 1729
Reputation: 9
Install mbstring For Php 5.6
sudo apt install php5.6-mbstring
For php 7.0
sudo apt install php7.0-mbstring
Upvotes: 0
Reputation: 1043
The function mb_strlen() is not enabled by default in PHP
. You need to install it manually. Check details here:
http://www.php.net/manual/en/mbstring.installation.php
Upvotes: 1