Home >Backend Development >PHP Tutorial >linux - The mbstring extension of php7 under centos7 cannot be loaded normally, how to solve it? --solved,

linux - The mbstring extension of php7 under centos7 cannot be loaded normally, how to solve it? --solved,

WBOY
WBOYOriginal
2016-08-04 09:19:532862browse

1. Problem: PHP’s mbstring extension cannot be loaded normally.
2. Environment: centos7.2 virtual machine, PHP Version => 7.0.8
My php is installed through yum, the installation source is webstatic, the mbstring extension also uses this source, and the version is correct.
Check that the extension is enabled in /etc/php.d/mbstring.ini and /lib64/php/modules/mbstring.so also exists.
But when calling the mb_strlen() function, an error occurs:
3, code and error

<code>      1 <?php
      2 $len =  mb_strlen('hello world');
</code>
<code>PHP Fatal error:  Uncaught Error: Call to undefined function mb_strlen() in /var/www/php-test/mb-encoding/mb-strlen.php:2
    349 Stack trace:
    350 #0 {main}
    351   thrown in /var/www/php-test/mb-encoding/mb-strlen.php on line 2
</code>

4, added:
php -m is available

<code>> php -m | grep mbstring
mbstring</code>

But there is no
5 in php -info, solved:
Someone asked this question before: https://segmentfault.com/q/10...

Reply content:

1. Problem: PHP’s mbstring extension cannot be loaded normally.
2. Environment: centos7.2 virtual machine, PHP Version => 7.0.8
My php is installed through yum, the installation source is webstatic, the mbstring extension also uses this source, and the version is correct.
Check that the extension is enabled in /etc/php.d/mbstring.ini and /lib64/php/modules/mbstring.so also exists.
But when calling the mb_strlen() function, an error occurs:
3, code and error

<code>      1 <?php
      2 $len =  mb_strlen('hello world');
</code>
<code>PHP Fatal error:  Uncaught Error: Call to undefined function mb_strlen() in /var/www/php-test/mb-encoding/mb-strlen.php:2
    349 Stack trace:
    350 #0 {main}
    351   thrown in /var/www/php-test/mb-encoding/mb-strlen.php on line 2
</code>

4, added:
php -m is available

<code>> php -m | grep mbstring
mbstring</code>

But there is no
5 in php -info, solved:
Someone asked this question before: https://segmentfault.com/q/10...

<code>php -m | grep mbstring</code>

It’s there if it’s there, it’s gone if it’s not. If it’s not there, you need to re-download the mbstring source code, compile and install it

The above is the answer before the question was revised. .

There is no extension loaded in ini, will it be in php -m?

php-cli and php-cgi are the same version of php?
It’s not like there are two versions of php on this machine..

Someone has asked this question before, you can refer to this question, https://segmentfault.com/q/10....

The main reason is that after installing the extension, php-fpm (FastCGI Process Manager: FastCGI Process Manager) did not restart, resulting in inconsistent php configuration files loaded by cgi and cli.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn