在 PHP 7 Ubuntu 14.04 上调用未定义的函数 mb_strlen() [英] Call to undefined function mb_strlen() on PHP 7 Ubuntu 14.04

查看:41
本文介绍了在 PHP 7 Ubuntu 14.04 上调用未定义的函数 mb_strlen()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Yii 安装,直到今天都运行良好.我今天在我的机器上安装了更新,之后在所有页面上都抛出了这个错误:

I had a Yii installation that was working fine up until today. I installed updates on my machine today after which this error was being thrown on all pages:

PHP 致命错误 – yii\base\ErrorException

PHP Fatal Error – yii\base\ErrorException

Uncaught Error: Call to undefined function yii\web\mb_strlen() in/application/vendor/yiisoft/yii2/web/ErrorHandler.php:404

Uncaught Error: Call to undefined function yii\web\mb_strlen() in /application/vendor/yiisoft/yii2/web/ErrorHandler.php:404

我运行了 composer update 但错误仍然存​​在.

I ran composer update but the error persists.

我在 Ubuntu 14.04 上的 PHP 7 上使用 yii 2.0.7.我该如何解决这个问题?

I am using yii 2.0.7 on PHP 7 on Ubuntu 14.04. How do I fix this?

推荐答案

由于 mb_strlen() 实际上是 mbstring php 扩展的一部分,而不是一个函数在yii2中.

The error is a bit of a red herring since mb_strlen() is actually part of the mbstring php extension and not a function in yii2.

在 php5 中 mbstringlibapache2-mod-php5 的一部分一>.

In php5 mbstring was part of libapache2-mod-php5.

它似乎从 libapache2-mod-php7 中丢失了.要解决此问题,请安装 php7.x-mbstring 包,其中 x 是您的版本:

It seems to be missing from libapache2-mod-php7. To fix this install the php7.x-mbstring package where x is your version:

sudo apt install php7.x-mbstring

您可能需要在此安装后重新启动 Apache.

You may need to restart Apache after this install.

这篇关于在 PHP 7 Ubuntu 14.04 上调用未定义的函数 mb_strlen()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆