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...
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
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.