Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Fatal error when trying to access phpmyadmin mb_detect_encoding

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.

like image 744
milan Avatar asked Nov 12 '12 21:11

milan


2 Answers

After reading about the extension_dir = "ext" i added the line to php.ini but didnt work, then started to look apache error log and saw the PHP was in fact unable to find the dll's in the specified directory "ext". I commented the extension_dir line, restarted Apache and looked the error log again, saw that PHP was now looking the dll's in C:/PHP/ext (by default i guess), but since im using other folders, that's not the correct path, so i uncommented the extension_dir line and wrote this:

extension_dir = "C:/Apache24/PHP/ext" 

In my configuration that is the correct path to dll's.

and of course, uncommented:

extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll

Restarted the Apache server and internet browser and now phpMyAdmin works with my mySQL login.

So, dll's incorrect path and dll's needed commented in php.ini were the problem.

Remember to restart Apache and internet browser after editing config files.

System spec: Windows 7 HB 64bit httpd-2.4.4-win32-ssl_0.9.8.zip php-5.4.16-Win32-VC9-x86.zip phpMyAdmin-4.0.4.1-all-languages.zip mysql-installer-community-5.6.11.0.msi

Hope this help. Thx for your comments too.

like image 20
phpNoob Avatar answered Sep 17 '22 03:09

phpNoob


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();
like image 109
Michel Feldheim Avatar answered Sep 19 '22 03:09

Michel Feldheim