mb_convert_encoding does not work in PHP 8.1.4
Description
The following code:
<?php
$data=mb_convert_encoding($data,'UTF-8','GB18030');
Resulted in this output:
Fatal error: Uncaught Error: Call to undefined function mb_convert_encoding() in D:\www\index.php:194 Stack trace:....
But I expected this output instead:
Some strings, including Chinese, English, numbers, etc.
PHP Version
PHP 8.1.4
Operating System
Windows 10
Make sure that the mbstring extension is loaded; check phpinfo() if this is the case.
Make sure that the mbstring extension is loaded; check
phpinfo()if this is the case.
Thanks for the reminder. It is confirmed that mbstring extension is not really loaded.
I'm using phpstudy V8.1.1.3 integrated environment, because it only supports up to PHP 8.0.2. So I manually added php8 1.4nts, also modified the path of "extension_dir" in the "PHP. Ini" file, then switched to "php8.1.4nts" in the phpstudy website management panel, and started the mbstring extension. It seems that everything is normal. But the page report error,it does not work. However when phpstudy switched to several lower versions of PHP are normal, which led to misjudgment.
After careful inspection, I found that the ";" in front of "extension_dir="D:\phpstudy_pro\extensions\PHP\php8.1.4nts\ext"" in the php.ini file of php8.1.4nts was not removed.
I also tested with several PHP versions supported by phpstudy and confirmed that it is a bug of phpsutdy. This bug is that when the extension_dir line in php.ini is commented out, the website management panel can still manage extensions (open and close) normally, but in fact these do not take effect at all.
I'm so sorry for wasting everyone's time because of a low-level mistake. Finally thanks again!