无法调用内置的 mb_internal_encoding 方法?
我正在尝试在 CentOS 5.3 VMware“盒子”上安装 indefero,但遇到了问题。 在安装的早期,我收到一个错误,我已经能够将其范围缩小到:
[root@code /var/www/html]# cat x.php
<?php
mb_internal_encoding("UTF-8");
?>
[root@code /var/www/html]# php x.php
PHP Fatal error: Call to undefined function mb_internal_encoding() in
/var/www/html/x.php on line 2
通过 Apache 通过 http 调用此脚本时,我收到相同的错误。 现在根据 PHP 手册 mb_internal_encoding 函数 应该是一个内置函数在 PHP 5 中。
我有 CentOS 5.3 i386 (Linux 代码 2.6.18-53.1.21.el5 #1 SMP Tue May 20 09:34:18 EDT 2008 i686 i686 i386 GNU/Linux)并且我已经安装了 PHP 5.2.9 。
[root@code /var/www/html]# php -v
PHP 5.2.9 (cli) (built: Jul 8 2009 06:03:36)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
我仔细检查过:selinux 已被禁用(目前)。
我该如何解决?
I'm trying to install indefero on a CentOS 5.3 VMware 'box' and I ran into a problem.
Quite early in the installation I get an error that I've been able to narrow down to this:
[root@code /var/www/html]# cat x.php
<?php
mb_internal_encoding("UTF-8");
?>
[root@code /var/www/html]# php x.php
PHP Fatal error: Call to undefined function mb_internal_encoding() in
/var/www/html/x.php on line 2
I get the same error when calling this script via http through Apache.
Now according to the PHP manual the mb_internal_encoding function should be a builtin in PHP 5.
I have CentOS 5.3 i386 (Linux code 2.6.18-53.1.21.el5 #1 SMP Tue May 20 09:34:18 EDT 2008 i686 i686 i386 GNU/Linux) and I've installed PHP 5.2.9.
[root@code /var/www/html]# php -v
PHP 5.2.9 (cli) (built: Jul 8 2009 06:03:36)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
I double checked: selinux has been disabled (for now).
How do i fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
对于 OpenSUse(zypper 包管理器):
和:
另一方面,您可以通过 YaST 软件管理器搜索它们。
请注意,您必须重新启动 apache http 服务器:
For OpenSUse (zypper package manager):
and:
In the other hand, you can search them through YaST Software manager.
Note that, you must restart apache http server:
对于 ubuntu 中的 php 5.6
重新启动 Apache2
For php 5.6 in ubuntu
Restart Apache2
apt-get install php7.3-mbstring
解决了ubuntu上的问题,php版本是php-fpm 7.3apt-get install php7.3-mbstring
solved the issue on ubuntu, php version is php-fpm 7.3如果有人在 ubuntu 中安装 php-mbstring 包时遇到问题,请执行以下操作
<代码>
sudo apt-get install libapache2-mod-php5
If someone is having trouble with installing
php-mbstring
package in ubuntu do followingsudo apt-get install libapache2-mod-php5
如果您不知道如何在windows中启用php_mbstring扩展,请打开您的php.ini并删除扩展之前的分号:
修改后将此更改
为此
,您需要重置您的php服务器。
If you don't know how to enable php_mbstring extension in windows, open your php.ini and remove the semicolon before the extension:
change this
to this
after modification, you need to reset your php server.
对于 Debian/Ubuntu:
sudo apt-get install php7.0-mbstring
For Debian/Ubuntu:
sudo apt-get install php7.0-mbstring
mbstring 是一个“非默认”扩展,默认情况下不启用; 请参阅手册的此页:
因此,您可能必须启用该扩展,修改 php.ini 文件(并重新启动 Apache,以便考虑您的修改)
我不使用 CentOS,但您可能必须先安装扩展,使用类似这样的东西(请参阅这个页面,例如,这似乎给出了一个解决方案):
(包名称可能有点不同;所以,使用 yum search得到它:-) )
mbstring is a "non-default" extension, that is not enabled by default ; see this page of the manual :
So, you might have to enable that extension, modifying the php.ini file (and restarting Apache, so your modification is taken into account)
I don't use CentOS, but you may have to install the extension first, using something like this (see this page, for instance, which seems to give a solution) :
(The package name might be a bit different ; so, use yum search to get it :-) )