无法使用 PHP 7 初始化 mbstring
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34471633/
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
Cannot Initialize mbstring with PHP 7
提问by NoahMCM
Whenever I try to access phpMyAdmin, I receive the following error:
每当我尝试访问 phpMyAdmin 时,都会收到以下错误:
"The mbstring extension is missing. Please check your PHP configuration."
"缺少 mbstring 扩展。请检查您的 PHP 配置。"
I am running a LEMP stack on a CentOS 7 server. I have elected to use PHP 7 for this installation. I have not experienced this error on identical set-ups running earlier versions of PHP.
我在 CentOS 7 服务器上运行 LEMP 堆栈。我已选择在此安装中使用 PHP 7。在运行早期 PHP 版本的相同设置上,我没有遇到过这个错误。
extension_loaded('mbstring')
returns false even though mbstring.ini(/etc/php.d/) contains:
extension_loaded('mbstring')
即使mbstring.ini(/etc/php.d/) 包含:
; Enable mbstring extension module
extension=mbstring.so
I am 100% sure that the mbstring module is installed on my server.
我 100% 确定 mbstring 模块安装在我的服务器上。
I'm completely stumped so if anyone has any ideas whatsoever, please let me know. Thanks.
我完全被难住了,所以如果有人有任何想法,请告诉我。谢谢。
采纳答案by NoahMCM
A solution was reached with the following method:
通过以下方法得到了解决方案:
I put extension=mbstring.so
inside php.ini even though that is no longer the method PHP uses by default to load modules.
我把extension=mbstring.so
php.ini放在里面,即使这不再是 PHP 默认使用的加载模块的方法。
From php.ini itself:
从 php.ini 本身:
Note: packaged extension modules are now loaded via the .ini files found in the directory /etc/php.d; these are loaded by default.
注意:打包的扩展模块现在通过目录 /etc/php.d 中的 .ini 文件加载;这些是默认加载的。
It seemed to fix my problem. I would still be interested to hear if anyone else has a different take on this matter.
它似乎解决了我的问题。我仍然很想知道是否有人对此事有不同的看法。
回答by Chopchop
For those who have debian :
对于那些拥有 debian 的人:
sudo apt-get install php7.0-mbstring
Otherwise in centos (tested in centos 6.6)
否则在 centos(在 centos 6.6 中测试)
sudo yum install php70w-mbstring
and as @mpen said you can activate it
正如@mpen所说,你可以激活它
sudo phpenmod mbstring
回答by Sankar Subburaj
For PHP7 on centos
对于 Centos 上的 PHP7
try this yum install php70-mbstring
尝试这个 yum install php70-mbstring
回答by stadja
I had this problem for a long time. I found the correct way (for me) to correct it... and it's fairly simple :)
我有这个问题很长时间了。我找到了正确的方法(对我来说)来纠正它......而且它相当简单:)
Juste add "universe" on the xenial-updates
Juste 在 xenial-updates 上添加“universe”
# cat /etc/apt/sources.list.d/*
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-backports main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial main universe
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-proposed main
deb [arch=amd64] http://security.ubuntu.com/ubuntu xenial-security main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-updates main **universe**
回答by Gimo
run sudo apt-get update, sudo apt-get upgrade before installing with sudo apt-get install php-mbstring.
在使用 sudo apt-get install php-mbstring 安装之前运行 sudo apt-get update,sudo apt-get upgrade。
I had the same problem today and found this way.
我今天遇到了同样的问题,并找到了这种方式。