无法使用 PHP 7 初始化 mbstring

2022-01-05 00:00:00 centos php mysql phpmyadmin

每当我尝试访问 phpMyAdmin 时,都会收到以下错误:

Whenever I try to access phpMyAdmin, I receive the following error:

"缺少 mbstring 扩展.请检查您的 PHP 配置."

我在 CentOS 7 服务器上运行 LEMP 堆栈.我已选择在此安装中使用 PHP 7.我在运行早期 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.

extension_loaded('mbstring') 返回 false,即使 mbstring.ini (/etc/php.d/) 包含:

extension_loaded('mbstring') returns false even though mbstring.ini (/etc/php.d/) contains:

; Enable mbstring extension module
extension=mbstring.so

我 100% 确定 mbstring 模块安装在我的服务器上.

I am 100% sure that the mbstring module is installed on my server.

我完全被难住了,所以如果有人有任何想法,请告诉我.谢谢.

I'm completely stumped so if anyone has any ideas whatsoever, please let me know. Thanks.

推荐答案

通过以下方法达成了解决方案:

A solution was reached with the following method:

我将 extension=mbstring.so 放在 php.ini 中,尽管 PHP 不再默认使用该方法来加载模块.

I put extension=mbstring.so inside php.ini even though that is no longer the method PHP uses by default to load modules.

来自 php.ini 本身:

From php.ini itself:

注意:打包的扩展模块现在通过/etc/php.d 目录中的 .ini 文件加载;这些是默认加载的.

Note: packaged extension modules are now loaded via the .ini files found in the directory /etc/php.d; these are loaded by default.

它似乎解决了我的问题.我仍然很想知道是否有人对此事有不同的看法.

It seemed to fix my problem. I would still be interested to hear if anyone else has a different take on this matter.

相关文章