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

miCRoSCoPiC_eaRthLinG picture miCRoSCoPiC_eaRthLinG · Nov 17, 2010 · Viewed 16.3k times · Source

I have this custom compiled PHP (v5.3.3) with the following extensions enabled (via configure):

./configure 
--prefix=/usr/local/php5.3.3 
--with-config-file-path=/usr/local/apache2/conf 
--with-apxs2=/usr/local/apache2/bin/apxs 
--with-bz2 
--with-curl=/usr/lib 
--with-curlwrappers 
--with-freetype-dir=/usr/local 
--with-gd=/usr/local 
--with-gettext 
--with-gmp 
--with-iconv=/usr/local 
--with-imap=/usr/local/imap2007e 
--with-imap-ssl 
--with-jpeg-dir=/usr/local/lib 
--with-kerberos 
--with-libxml-dir=/usr/lib 
--with-mcrypt=/usr/local 
--with-mhash 
--with-mysql=/usr/lib/mysql 
--with-mysql-sock=/var/lib/mysql/mysql.sock 
--with-mysqli=/usr/lib/mysql/mysql_config 
--with-openssl=/usr 
--with-pcre-dir=/usr/local/lib 
--with-pear 
--with-png-dir=/usr/local/lib 
--with-readline 
--with-sqlite 
--with-xmlrpc 
--with-xsl=/usr/local 
--with-zlib-dir=/usr/local/lib 
--with-zlib=/usr/local 
--without-pgsql 
--enable-bcmath 
--enable-calendar 
--enable-exif 
--enable-embedded-mysqli=shared 
--enable-ftp 
--enable-gd-jis-conv 
--enable-gd-native-ttf 
--enable-mbstring=all 
--enable-mbregex 
--enable-shared 
--enable-sockets 
--enable-soap 
--enable-sqlite-utf8 
--enable-zend-multibyte 
--enable-zip 
--disable-pdo 
--disable-phar 

phpinfo() clearly states that mbstring is enabled: alt text

Funny thing is when I try to run some PHP scripts (SugarCRM updates), it reports the following error:

PHP Fatal error: Call to undefined function mb_strlen() in crm/include/pclzip/pclzip.lib.php on line 4165

Can anyone throw some light into WHY this is happening and how to fix this?

Thanks, m^e

Answer

ajreal picture ajreal · Nov 17, 2010

For PHP 4.3.3 or before, To enable that feature, you will have to supply either one of the following options to the LANG parameter of --enable-mbstring=LANG ; --enable-mbstring=cn for Simplified Chinese support, --enable-mbstring=tw for Traditional Chinese support, --enable-mbstring=kr for Korean support, --enable-mbstring=ru for Russian support, and --enable-mbstring=ja for Japanese support (default). To enable all supported encoding, use --enable-mbstring=all

try

  • configure again with --enable-mbstring only

  • grep mb_strlen $PATH_TO_YOUR_PHP_BINARY to see is it exist