[英]Call to undefined function mb_strlen() on PHP 7 Ubuntu 14.04
[英]PHP: Call to undefined function mb_strlen() - on custom compiled PHP with mbstring enabled
我有這個自定義編譯的PHP(v5.3.3),啟用了以下擴展(通過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()明確指出mbstring已啟用:
有趣的是,當我嘗試運行一些PHP腳本(SugarCRM更新)時,它會報告以下錯誤:
PHP致命錯誤:在第4165行的crm / include / pclzip / pclzip.lib.php中調用未定義的函數mb_strlen()
任何人都可以為這是為什么會發生這種情況以及如何解決這個問題?
謝謝,m ^ e
在我使用PHP和Apache的Windows系統上,我不得不修改PHP.INI文件,使其包含以下行:
extension=php_mbstring.dll
(在主[PHP]
部分內)並重啟Apache。 之后,對mb_strlen
的調用確實成功了。
對於PHP 4.3.3或更高版本,要啟用該功能,您必須向LANG參數--enable-mbstring = LANG提供以下任一選項之一; --enable-mbstring = cn用於簡體中文支持, - enable-mbstring = tw用於繁體中文支持, - enable-mbstring = kr用於韓語支持, - enable-mbstring = ru用於俄語支持,以及--enable -mbstring = ja表示日語支持(默認)。 要啟用所有支持的編碼,請使用--enable-mbstring = all
嘗試
再次使用--enable-mbstring
配置
grep mb_strlen $PATH_TO_YOUR_PHP_BINARY
看它是否存在
簡單解決方案
相反, mb_strlen()
只使用strlen()
。
對我來說,它工作了幾次。
我遇到了同樣的問題,這是php版本的一個問題。
首輪
sudo apt install php-mbstring
將mbstring安裝到最新安裝的php版本
然后運行:
sudo apt-get dist-upgrade
並重啟apache
sudo /etc/init.d/apache2 restart
祝好運
把這個phpinfo()放在一個php文件中輸出。 並在那里尋找MbString單獨的盒子,如果它不存在,那么它沒有正確安裝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.