Fatal Error: Call to Undefined Function Mb_Strlen()

Fatal error: Call to undefined function mb_strlen()

The function mb_strlen() is not enabled by default in PHP. Please read the manual for installation details:

http://www.php.net/manual/en/mbstring.installation.php

Call to undefined function mb_strlen() on PHP 7 Ubuntu 14.04

The error is a bit of a red herring since mb_strlen() is actually part of the mbstring php extension and not a function in yii2.

In php5 mbstring was part of libapache2-mod-php5.

It seems to be missing from libapache2-mod-php7. To fix this install the php7.x-mbstring package where x is your version:

sudo apt install php7.x-mbstring

You may need to restart Apache after this install.

Cannot enable mb_string in PHP

After over 3,5 hours of search, I found the solution!!! I HOPE IT WILL HELP SOMEONE ELSE !!

THE ERROR

So, the problem was that the extension_dir in the php.ini file was set to the wrong file. By default, it was to the following:

extension_dir = './'

THE SOLUTION

  1. Open you terminal ctrl+alt+t and type:
php -i | grep extension_dir

In my case, it ouputs:

/user/lib/php/20180731

  1. Find out your php.ini file:
    You can do that either by:
<?php
phpinfo();

Or on the terminal

php -i | grep 'php.ini'

  1. Go to your php.ini file and change the following line:
extension_dir = '/full/path/to/your/php/modules'

in my case, it was:

exension_dir = '/usr/lib/php/20180731'

SEE MORE

By the way, you have to do this after installing mbstring. To do that, You may find useful the following links:

PHP: Call to undefined function mb_strlen() - on custom compiled PHP with mbstring enabled

Fatal error: Call to undefined function mb_strlen()

Call to undefined function yii\helpers\mb_strlen() on PHP in Yii2 Framework

https://askubuntu.com/questions/772397/mbstring-is-missing-for-phpmyadmin-in-ubuntu-16-04

Fatal error: Uncaught Error: Call to undefined function mb_detect_encoding() in Uniform Server with PHP 7.2

The developer of Uniform Server managed to fix the problem, saying so in this post.

Ok.. Thanks for bringing this up.. Looks like made a mistake on the spelling on the extensions folder. Please rename the /core/php72/extentions to /core/php72/extensions and everything should work as expected.. I have updated the module in Sourceforge.



Related Topics



Leave a reply



Submit