Cannot Initialize mbstring with PHP 7
Solution 1
A solution was reached with the following method:
I put extension=mbstring.so
inside php.ini even though that is no longer the method PHP uses by default to load modules.
From php.ini itself:
Note: packaged extension modules are now loaded via the .ini files found in the directory /etc/php.d; these are loaded by default.
It seemed to fix my problem. I would still be interested to hear if anyone else has a different take on this matter.
Solution 2
For those who have debian :
sudo apt-get install php7.0-mbstring
Otherwise in centos (tested in centos 6.6)
sudo yum install php70w-mbstring
and as @mpen said you can activate it
sudo phpenmod mbstring
Solution 3
For PHP7 on centos
try this yum install php70-mbstring
NoahMCM
Updated on July 09, 2022Comments
-
NoahMCM almost 2 years
Whenever I try to access phpMyAdmin, I receive the following error:
"The mbstring extension is missing. Please check your PHP configuration."
I am running a LEMP stack on a CentOS 7 server. I have elected to use PHP 7 for this installation. I have not experienced this error on identical set-ups running earlier versions of PHP.
extension_loaded('mbstring')
returns false even though mbstring.ini (/etc/php.d/) contains:; Enable mbstring extension module extension=mbstring.so
I am 100% sure that the mbstring module is installed on my server.
I'm completely stumped so if anyone has any ideas whatsoever, please let me know. Thanks.
-
Andrea over 8 yearsPerhaps the distribution of PHP 7 you used does not use the same configuration locations?
-
Zane almost 8 yearsI had already installed
php7.0-mbstring
but for some reasonphpenmod mbstring
did not enable it. I had to manually enable it using this method. Additionally, my environment required asudo service apache2 restart
for the change to take effect. -
mpen almost 8 yearsPS: It can be enabled with
sudo phpenmod mbstring
-
David Refoua over 7 yearsI needed to restart apache too
service httpd restart
-
David Refoua over 7 yearsFor CentOS 7 + PHP 7, the package name was
php70u-mbstring
. If you getNo package php70w-mbstring available
, you have to dosudo yum list | grep "\-mbstring"
to find the corresponding package. -
borislemke over 7 years
yum install php70-mbstring
did it for me on an Amazon Linux Instance -
fmc over 7 yearsI just installed php7 and had the same issue. Much appreciated, Chopchop!
-
ssaltman about 6 yearsThis is the correct answer if you have php 7.0 Note, first do a php -v to find your version.
-
Geoff over 5 years@DRSDavidSoft you should post your comment as an answer it solved my problem with php 5.6