Cannot Initialize mbstring with PHP 7

75,992

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

Share:
75,992
NoahMCM
Author by

NoahMCM

Updated on July 09, 2022

Comments

  • NoahMCM
    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
    Andrea over 8 years
    Perhaps the distribution of PHP 7 you used does not use the same configuration locations?
  • Zane
    Zane almost 8 years
    I had already installed php7.0-mbstring but for some reason phpenmod mbstring did not enable it. I had to manually enable it using this method. Additionally, my environment required a sudo service apache2 restart for the change to take effect.
  • mpen
    mpen almost 8 years
    PS: It can be enabled with sudo phpenmod mbstring
  • David Refoua
    David Refoua over 7 years
    I needed to restart apache too service httpd restart
  • David Refoua
    David Refoua over 7 years
    For CentOS 7 + PHP 7, the package name was php70u-mbstring. If you get No package php70w-mbstring available, you have to do sudo yum list | grep "\-mbstring" to find the corresponding package.
  • borislemke
    borislemke over 7 years
    yum install php70-mbstring did it for me on an Amazon Linux Instance
  • fmc
    fmc over 7 years
    I just installed php7 and had the same issue. Much appreciated, Chopchop!
  • ssaltman
    ssaltman about 6 years
    This is the correct answer if you have php 7.0 Note, first do a php -v to find your version.
  • Geoff
    Geoff over 5 years
    @DRSDavidSoft you should post your comment as an answer it solved my problem with php 5.6