问题
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:

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
回答1:
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
onlygrep mb_strlen $PATH_TO_YOUR_PHP_BINARY
to see is it exist
回答2:
On my Windows system with PHP and Apache, I had to modify the PHP.INI file so that it includes the following line:
extension=php_mbstring.dll
(inside the main [PHP]
section) and restart Apache. After that, the call to mb_strlen
did succeed.
回答3:
Put this phpinfo() in a some php file for the output. And look for MbString seperate box there, if it is not present, then it is not installed properly.
回答4:
Simple solution.
Instead mb_strlen()
only use strlen()
.
To me, it worked a few times.
回答5:
I had the same problem, this is an issue with php version.
first run
sudo apt install php-mbstring
to install mbstring to the latest installed version of php
then run:
sudo apt-get dist-upgrade
and restart apache with
sudo /etc/init.d/apache2 restart
Good luck
来源:https://stackoverflow.com/questions/4203730/php-call-to-undefined-function-mb-strlen-on-custom-compiled-php-with-mbstri