PHP missing mb_strpos function?

I get this error:

PHP Fatal error: Call to undefined function mb_strpos() in /my/file.php 

Which is strange because mb_strpos() was introduced in PHP 4 and I am running PHP 5.3.3

 $ php -v PHP 5.3.3 (cli) (built: Feb 22 2012 19:38:14) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies 

Does anyone else come across something like this and know how to fix it? I searched and I can’t understand.

PS. I am running centOS 5.

+6
source share
4 answers

MBString is not the default extension in PHP, and you should install it if you are using linux try

 yum install php-mbstring.x86_64 # for RedHat derivative systems 

as root user or

 apt-get install php-mbstring.x86_64 # for Debian derivative systems 

on windows you need to edit php.ini to use the dll extension library

Note: mb_strpos is still supported in PHP 5

+13
source

I would suggest that your version of PHP was not built with the option --enable-mbstring.

You can check with the phpinfo() function. There should be a "mbstring" section. I have it:

 mbstring Multibyte Support enabled Multibyte string engine libmbfl HTTP input encoding translation disabled 
+1
source

sounds just not installed. please see the documentation :

mbstring is a non-standard extension. This means that it is not enabled by default. You must explicitly enable the module with the configure option. [...]

+1
source

This is the core function of PHP . It seems your web host does not have the PHP mbstring extension installed. Check your phpinfo (); and look for mbstring in it.

-1
source

Source: https://habr.com/ru/post/910637/


All Articles