php.ini中的centos +启用mbstring扩展仍未显示在phpinfo()

时间:2016-07-03 05:06:47

标签: php linux apache centos

我正在使用CentOS发行版,我尝试在我的php.ini中启用mbstring。

我的php.ini位于/usr/local/lib/php.ini,我尝试在那里启用mbstring。

这是截图: enter image description here

当我访问我的phpinfo()页面时,仍然没有启用mbstring。

我已经重新启动了apache,这是我的命令service httpd restart 但仍然没有工作。

这里似乎有什么问题?

非常感谢您的帮助!

谢谢!

2 个答案:

答案 0 :(得分:0)

您正在使用CentOs,因此扩展程序扩展名为.so。在上面的示例中,您将启用Windows DLL。

尝试取消注释或添加extension=php_mbstring.so

答案 1 :(得分:0)

  1. 首先安装mbstring
sudo yum install php-mbstring
  1. 检查mbstring是否出现在php -m | grep mbstring

  2. 在我的情况下检查phpinfo中的扩展目录为/usr/lib64/php/modules/

  3. httpd / appache正在/etc/httpd/modules中搜索扩展名
    就我而言,我复制了文件

$ cp /usr/lib64/php/modules/mbstring.so /etc/httpd/modules/mbstring.so
  1. sudo service httpd restart

请注意,如果您使用的是AWS EC2,请尝试停止并启动服务器以 重新加载新模块 停止并启动EC2之后,它对我有用

  1. [可选]最后放置在php.ini中
[mbstring]
mbstring.language = all
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = UTF-8
mbstring.encoding_translation = On
mbstring.detect_order = UTF-8
mbstring.substitute_character = none;
mbstring.func_overload = 0
mbstring.strict_encoding = Off