PHP Fatal error when trying to access phpmyadmin mb_detect_encoding

milan picture milan · Nov 12, 2012 · Viewed 99.7k times · Source

Not sure what happened, but below is what the log is giving me when trying to access phpmyadmin, please help. Trying to debug a different problem and ran into this. Not really possible to revert back to when it was working.

PHP Fatal error: Call to undefined function mb_detect_encoding() in /usr/share/php/gettext/gettext.inc on line 177

When trying to go the the site, I get this error, I think it's likely the two errors are related:

Database connection error (1): The MySQL adapter 'mysqli' is not available.

Answer

Michel Feldheim picture Michel Feldheim · Nov 12, 2012

First error is caused by php because the extension mbstring is either not installed or not active.

The second error is output of phpMyAdmin/your site asking you to install / enable the mysqli extension.

To enable mbstring and mysqli edit your php.ini and add/uncomment the two lines with mbstring.so and mysqli.so on unix or mbstring.dll and mysqli.dll on windows

Unix /etc/(phpX/)php.ini

extension=mysqli.so
extension=mbstring.so

Windows PHP installation folder\etc\php.ini

extension=mysqli.dll
extension=mbstring.dll

Don't forget to restart your webserver after this.

EDIT: User added he was using redhat in the comments so here's how you install extensions on all CentOS/Fedora/RedHat/Yum based linux distros

sudo yum install php-mysqli
sudo yum install php-mbstring

restart your werbserver
sudo /etc/init.d/httpd restart

you can verify your installation with a little php script in your document root. This lists all settings, versions and active extensions you've installed for php

test.php

<?php
phpinfo();