为什么 mb_convert_encoding 会失败?

Why does mb_convert_encoding fail?

为什么

<?php 

echo "HELLO WORLD 1"; // shows
error_reporting(E_ALL);
echo "HELLO WORLD 2"; // shows
print_r(mb_list_encodings()); // does not show
echo "HELLO WORLD 3"; // does not show
$result = mb_convert_encoding("apple", 'UTF-8');
echo "HELLO WORLD 4"; // does not show;
echo $result; // does not show;

// no error what so ever displayed.

?>

失败?什么可以使此功能失败?

我有一个 PHP 网页运行代码并在这一行停止,returns HTTP 500 错误。

但是我不知道为什么会失败。有什么检查地点的建议吗?

更新: 错误日志显示

PHP Fatal error:  Call to undefined function mb_convert_encoding()

PHP Fatal error: Call to undefined function mb_convert_encoding()

这意味着 mb_convert_encoding 没有安装,因为您的 PHP 版本没有安装 MB 扩展。如何安装它取决于你如何安装PHP。您的操作系统很可能有一个包管理器(apt-get 或类似的),可以让您快速安装它。否则,请参阅 the manual