确保 PHP 是在启用 php_mbstring.dll 的情况下编译的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12708855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 04:05:26  来源:igfitidea点击:

Ensure that PHP is compiled with php_mbstring.dll enabled

phpmpdfmbstring

提问by Bryan

I'm currently experiencing error on my application using php. here is the error message

我目前在使用 php 的应用程序上遇到错误。这是错误信息

Error - mPDF requires mb_string functions. Ensure that PHP is compiled with php_mbstring.dll enabled.

I'm using third party library to generate pdf file (MPDF). It works fine on my loaclhost (windows) but when we deploy it on the linux server, it throws the above error.

我正在使用第三方库生成 pdf 文件 (MPDF)。它在我的 loaclhost (windows) 上运行良好,但是当我们将它部署到 linux 服务器上时,它会抛出上述错误。

Can anyone help me on what's going on and how could I fix it. It seems that the php_mbstring.dll is missing on our linux server configuration.

任何人都可以帮助我了解发生了什么以及我该如何解决。我们的 linux 服务器配置中似乎缺少 php_mbstring.dll。

回答by Mark Baker

if (!function_exists("mb_check_encoding")) {
    die('mbstring extension is not enabled');
}

And if you get that error, then rebuild PHP from source with mbstring enabled, or apt-get to include it in the build

如果您遇到该错误,请从启用 mbstring 的源代码重建 PHP,或 apt-get 将其包含在构建中

回答by user3288151

I was having the same problem on CentOS Linux. "yum install php-mbstring.x86_64" fixed it for me

我在 CentOS Linux 上遇到了同样的问题。“yum install php-mbstring.x86_64”为我修复了它

回答by Daniel James

On Debian or Ubuntu, the mbstring package is not pulled in by default when you install php. You can fix this mPDF error with:

在 Debian 或 Ubuntu 上,安装 php 时默认情况下不会拉入 mbstring 包。您可以使用以下方法修复此 mPDF 错误:

apt install php-mbstring

回答by Pramod Vinay

Edit php.ini and extension=php_mbstring.dllremove the ;after which run the following commands

编辑 php.ini 并extension=php_mbstring.dll删除;之后运行以下命令

For php7.0 sudo apt-get install php7.0-mbstringFor php5.6 sudo apt-get install php5.6-mbstring
worked for me :)

对于 php7.0 sudo apt-get install php7.0-mbstring对于 php5.6sudo apt-get install php5.6-mbstring
对我有用 :)

回答by Udit

Find your php.ini, uncomment the line with the extension, and restart the server

找到您的 php.ini,取消注释扩展名的行,然后重新启动服务器