Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Dragotic's avatar

Call to undefined function mb_strimwidth()

Hello guys,

I'm having an error with Laravel. I currently have Laravel 5.5 installed through Docker, and when I'm trying to run str_limit() it throws:

ErrorException (E_ERROR) Call to undefined function Illuminate\Support\mb_strimwidth()

Do you have any idea what it might be going wrong?

0 likes
6 replies
Talinon's avatar

It sounds like you don't have the Multibyte String (php-mbstring) PHP extension installed.

Running this command should install it on your server: sudo apt-get install php-mbstring

6 likes
Dragotic's avatar

I don’t have PHP at all on my machine. I’m running it on docker and it has PHP 7.0.

Talinon's avatar

See if the module is activated by either <?php echo phpinfo(); or run the command: php -i | grep mbstring?

Dragotic's avatar

Supposedly when you use composer install Laravel pulls a package Symfony/Polyfill-mbstring which an extension from mbstring.

That's why I'm wondering what's going on.

Sijan's avatar

I am having the same issue. I checked my phpinfo() and couldn't find php-mbstring. So, I did sudo apt-get install php-mbstring sudo service apache2 restart

php-mbstring is already there in my machine and the problem still persists. Any help?

almounkez's avatar

change in the file NewCommand.php where you can find it at C:\Users**\AppData\Roaming\Composer\vendor\laravel\installer\src

from $name = mb_rtrim($input->getArgument('name'), '/\'); into $name = rtrim($input->getArgument('name'), '/\');

Please or to participate in this conversation.