19

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.

Panda
  • 6,824
  • 6
  • 34
  • 49
milan
  • 2,029
  • 7
  • 24
  • 34
  • Yes but I don't think this is a joomla issue. Joomla is having trouble connecting to the the database. – milan Nov 12 '12 at 21:20
  • I decided to delete the server and start fresh, everything is working properly on the new one. thanks everyone. – milan Nov 12 '12 at 23:12

15 Answers15

27

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();
Michel Feldheim
  • 16,339
  • 5
  • 53
  • 77
10

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.

phpNoob
  • 101
  • 1
  • 3
10

in ubuntu 16.04 when i tried to connect to phpmyadmin a white blank paged appeared so i ran the above command and phpmyadmin works

sudo apt-get install php-mbstring php7.0-mbstring php-gettext

for mysql support install

sudo apt-get install php7.0-mysql

tested in ubuntu 16.04 with php 7 version

Dimitris Kougioumtzis
  • 1,880
  • 1
  • 20
  • 32
3

It looks like your PHP installation does not have the mbstring extension and the mysqli adapter extension installed.

Please check your phpinfo(); or run php -i | grep 'mbstring\|mysqli' in a terminal.

Koen.
  • 21,087
  • 6
  • 75
  • 76
  • I ran phpinfo. What should I look for? – milan Nov 12 '12 at 21:19
  • Or the lack of it. In that case it means you have to install them. – Koen. Nov 12 '12 at 21:21
  • in the configure command, i have: mysql=shared,/usr' '--with-mysqli=shared,/usr/lib64/mysql/mysql_config' '--... in the additional .ini files parsed section I have ql.ini, /etc/php.d/mysqli.ini, /etc/php.d/oci8.in and in the additional .ini files parsed section I have .d/json.ini, /etc/php.d/mbstring.ini, /etc/php.d/mcrypt – milan Nov 12 '12 at 21:22
  • I'm pretty sure mbstring is installed because yum install php-mbstring and it said it was installed – milan Nov 12 '12 at 21:23
  • Have you restarted php afterwards? – Koen. Nov 12 '12 at 21:24
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/19452/discussion-between-koen-and-milan) – Koen. Nov 12 '12 at 21:25
3

I had the same problem on my windows7- 32 bit:

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

when i opened my php.ini file , "extension_dir" line looked like following :

extension_dir = "C:/wamp/bin/php/php5.4.16/ext/"

which i changed to :

extension_dir = "C:\wamp\bin\php\php5.4.16\ext\"

and it worked.

Rajeev Ranjan
  • 107
  • 1
  • 6
2

In php.ini, I had to change

extension_dir = "ext"

to

extension_dir = "C:/PHP/ext"

as my PHP was installed in C:\PHP. I had to use / instead of \, and then it worked.

Also uncomment mbstrings, mysqli and mysql extensions.

Arman H
  • 5,018
  • 9
  • 47
  • 70
  • 1
    Remove the comment (;) from these extensions `extension=php_mbstring.dll` and `extension=php_mysqli.dll` and `extension=php_gettext.dll` – Manoj Kumar Jul 29 '16 at 08:35
1

What helped me (using XAMPP on Windows) was to:

  • make sure that my path included the correct path for PHP (I had two PHP installations, one under c:\php and the XAMPP installation in c:\xampp\php which was the one I wanted to use)
  • check that the lines
    extension_dir="C:\xampp\php\ext"
    extension=php_mbstring.dll
    extension=php_exif.dll ; Must be after mbstring as it depends on it
    were uncommented in the php.ini file (i.e. no ; at the beginning)
  • restart the Apache server
  • last but not least, clear the cache when reloading the page http://localhost/phpmyadmin/ (for instance with Ctrl-F5 in Chrome)
user2314737
  • 21,279
  • 16
  • 81
  • 95
1

Recompile PHP with mbstring.

./configure --enable-http --with-apxs2 --with-mysql --with-gd --with-curl --with-mbstring

make 

make install
Harikrishnan
  • 8,629
  • 9
  • 75
  • 119
0

Try to install mysqli and pdo. Put it in terminal:

./configure --with-mysql=/usr/bin/mysql_config  \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd
RDK
  • 4,475
  • 2
  • 18
  • 27
0

My guess would be to check that the mysqli extension is enabled in your PHP configuration. More info would be great (eg. OS, AMP stack, etc.).

Check in your php.ini configuration for mysqli and make sure there is no ';' in front of the extension. The one enabled on my setup is php_mysqli_libmysql.dll.

thorne51
  • 556
  • 7
  • 22
0

I tried on Windows and I was getting same issue after enabling this in PHP installation folder\etc\php.ini:

extension=mysqli.dll 
extension=mbstring.dl

You should also enable the following in the ini file:

extension_dir = "ext"

phpMyadmin is working now!

Danny Beckett
  • 18,294
  • 21
  • 100
  • 129
0

In windows 2008 Server.

i removed ";" in front of extension=php_mbstring.dll in php.ini file and it worked... i followed below link...

https://bugs.php.net/bug.php?id=64965

0
  1. Some versions of windows do not come with libmysql.dll which is necessary to load the mysql and mysqli extensions. Check if it is available in C:/Windows/System32 (windows 7, 32 bits). If not, you can download it DLL-files.com and install it under C:/Windows/System32.
  2. If this persists, check your apache log files and resort to a solution above which responds to the error logged by your server.
Cedric Ipkiss
  • 3,682
  • 2
  • 30
  • 50
0

One options is: disabled this extension_dir = "ext"

and the other is:

go to wamp icon and see php and the click on php error logs then from error log u can find exact error.

this error occurs only if paths are not properly set.

0

I had the same trouble, this is what worked for me.

You can click at the wampserver icon, then at the PHP error log. Check if it says this: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll'

If yes, then you can reload your version of PHP, by clicking at the wampserver icon, then PHP, then version, and then you click at your version. Wait for everything to be online again, then try to access phpmyadmin.

DBr
  • 1