PHP:调用未定义函数 mb_strlen() - 在启用 mbstring 的自定义编译 PHP 上
我有这个自定义编译的 PHP (v5.3.3),并启用了以下扩展(通过配置):
./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() 清楚地表明 mbstring 已启用:
有趣的是,当我尝试运行一些 PHP 脚本(SugarCRM 更新)时,它报告以下错误:
PHP 致命错误:在 crm/include/pclzip/pclzip.lib.php 第 4165 行调用未定义函数 mb_strlen()
任何人都可以解释为什么会发生这种情况以及如何解决此问题吗?
谢谢, 米^e
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试
仅使用
--enable-mbstring
再次配置grep mb_strlen $PATH_TO_YOUR_PHP_BINARY
查看它是否存在try
configure again with
--enable-mbstring
onlygrep mb_strlen $PATH_TO_YOUR_PHP_BINARY
to see is it exist在装有 PHP 和 Apache 的 Windows 系统上,我必须修改 PHP.INI 文件,使其包含以下行:(
在主
[PHP]
部分内)并重新启动 Apache。之后,对 mb_strlen 的调用确实成功了。On my Windows system with PHP and Apache, I had to modify the PHP.INI file so that it includes the following line:
(inside the main
[PHP]
section) and restart Apache. After that, the call tomb_strlen
did succeed.我也遇到了同样的问题,这是php版本的问题。
首先运行
将 mbstring 安装到最新安装的 php 版本,
然后运行:
并重新启动 apache 祝
你好运
I had the same problem, this is an issue with php version.
first run
to install mbstring to the latest installed version of php
then run:
and restart apache with
Good luck
将此 phpinfo() 放入某个 php 文件中以进行输出。并查找那里的 MbString 单独框,如果它不存在,则说明安装不正确。
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.
简单的解决方案。
相反,
mb_strlen()
仅使用strlen()
。对我来说,它有效了几次。
Simple solution.
Instead
mb_strlen()
only usestrlen()
.To me, it worked a few times.