38

When i want run phpMyAdmin on my browser, that show me this error:

Fatal error: Call to undefined function __() in /usr/share/phpMyAdmin/libraries/core.lib.php on line 229
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0010  344984  {main}( )   ../index.php:0
    2   0.0026  502720  require_once( '/usr/share/phpMyAdmin/libraries/common.inc.php' )    ../index.php:12
    3   0.0285  3836408 require( '/usr/share/phpMyAdmin/libraries/session.inc.php' )    ../common.inc.php:344
    4   0.0288  3846488 PMA_fatalError( )   ../session.inc.php:97

I use fedora 17 with PHP 5.5.7.

Any idea for solve problem?

2
  • how did you install phpmyadmin?
    – user557846
    Commented Jan 20, 2014 at 20:40
  • yum --enablerepo=remi install phpmyadmin
    – meysam
    Commented Jan 20, 2014 at 20:46

10 Answers 10

37

Check that your session directory is writable by the webserver process.

The best way to do so is to create your own phpinfo file; in any web accessible folder create a file (you can call it test.php or phpinfo.php or whatever you'd like) with the following content:

<?php
phpinfo();
?>

Open that file in your browser (http://localhost/test.php or similar) and look for the line session.save_path. That's your session folder; make sure the permissions are suitable and see if that helps.

More information from a similar thread.

6
  • 2
    Thanks Isaac, I had the same problem with nginx and changed that with - chown root:nginx session Commented Mar 6, 2014 at 16:07
  • That undefined function is actually an error in core.lib.php file in phpmyadmin. The stack call shows you it's failing inside PMA_fatalError.
    – Glenn Plas
    Commented Aug 12, 2014 at 21:03
  • 6
    This is soved with correct permission for session dir. For example I have CentOS and my session dir is located at /var/lib/php/session. I my case I soved this to change the owner to apache: sudo chown -R apache:apache /var/lib/php/session
    – joseluisq
    Commented Nov 23, 2014 at 16:38
  • Thanks. after 2 days.. found the perfect solution Commented Jan 11, 2018 at 19:29
  • In my case the following answer was solving the problem: stackoverflow.com/questions/27537617/… and the problem was that after fiddling with the config.inc.php file it was owned by root:root. I've solved the problem by doing chown root:www-data config.inc.php Commented May 9, 2018 at 11:03
30

I just set up CentOS 7 and tried phpmyadmin and was having the same problem. Hope this helps

I set the correct permissions to the sessions directory and restarted apache, even disabled SELinux but was shown the same error

I did not have the php-mbstring installed - once i did that, it worked

sudo yum install php-mbstring

Check the requirements for phpmyadmin

3
  • Yep. I just needed to restart my PHP after yum install phpmyadmin. Commented Feb 25, 2015 at 16:59
  • Thanks @naveen! I added an answer for Debian users based on your answer. Commented Nov 27, 2016 at 10:29
  • It worked for me but in my case I used: apt-get install php7.0-mbstring Commented Jun 19, 2017 at 4:22
10

For Debian users: (I ended up in this thread as a Debian user) I read @naveen 's answer and it appeared I didn't have php-mbstring installed, installing it solved my problem:

sudo apt-get install php-mbstring

(After installing php-mbstring, don't forget to restart Apache:)

sudo systemctl restart apache2
2
  • 2
    Same here I went through many posts saying to change permissions however this simply helped. I was getting an error below: Fatal error: Uncaught Error: Call to undefined function __() in /usr/share/phpmyadmin/libraries/core.lib.php:235 I am using Raspbian
    – Matt
    Commented Apr 25, 2017 at 9:03
  • 2
    This works every time, dont forget to restart apache when you've installed php-mbstring
    – Stephen
    Commented Apr 28, 2017 at 22:14
3

In my case using php-fpm under CentOS 7, it was the reason @Issac pointed out, and just solved with:

mkdir -p /var/lib/php/session
chown -R apache:apache /var/lib/php

Then solved.

Just create the session folder, I think this direct solution can work on this specific case.

WARNING: Before you do this, be sure to check if the /var/lib/php folder exists, and check which user is in use for the php-fpm process. If you are using nobody for the php-fpm process, set 777 permission for the /var/lib/php/session can work well.

2
  • 1
    Thank you a dozen times over. The step that was missing for me was that /var/lib/php/session was not created, and chmoding /var/lib/php was insufficient - it doesn't get created dynamically. I am using NGINX, not apache, but it works the same, apparently. Thank you!
    – KGVT
    Commented Feb 21, 2019 at 20:57
  • Sorry, works the same with nginx as the user. Should try to be more clear for whoever comes next.
    – KGVT
    Commented Feb 21, 2019 at 23:55
2

Pretty much as other users had said... I'm running Debian 8 with PHP7 and ran into the issue, so just installing;

sudo apt-get install php7.0-mbstring

Followed by restarting the Apache service;

sudo service apache2 restart

And then phpmyadmin ran fine.

1

Check whether your PHP extensions are loaded. When the mysql or mysqli extensions fail to load, the result will be exactly this error (which is quite confusing). To check that your extensions are loading correctly, have a look at the output of the PHP function phpinfo() - all loaded extensions are listed there.

1

If you are using a different user for a reason, e.g. when having httpd-itk (RHEL/CentOS/Fedora) or apache2-mpm-itk (Debian/Ubuntu) and your main user is not apache or www-data, then do:

sudo usermod -a -G apache youruser

or

sudo usermod -a -G www-data youruser

depending on your distribution, then phpMyAdmin will work.

1

For me the error was in /usr/share/phpMyAdmin/libraries/sanitizing.lib.php.

I increased php error reporting following this advice and commented the offending line in sanitizing.lib.php by prepending // in front.

Then the error was more descriptive: Fatal error: require_once(): Failed opening required '/usr/share/php/php-gettext/gettext.inc' (include_path='.') in /usr/share/phpmyadmin/libraries/common.inc.php on line 477

I noticed that I somehow lost the php-gettext debian package, but after installing it phpMyAdmin worked again.

1

In my case this error was intermittent and I'd had phpMyAdmin installed and running fine for years. Reading the answers here, it seemed the error might have something to do with the sessions.

On Ubuntu 16.04 the PHP sessions are in:/var/lib/php/sessions and look like:

$ sudo ls -al /var/lib/php/sessions/
total 128
drwx-wx-wt 2 root     root     73728 Mar  4 14:09 .
drwxr-xr-x 4 root     root      4096 Mar  8  2017 ..
-rw------- 1 www-data www-data    67 Mar  4 14:05 sess_dvg6vo1k1s1c0353rjk09g9vu1
-rw------- 1 www-data www-data    67 Mar  4 13:49 sess_e4ha0gl4f7gukku1o2uc4h5rs2
-rw------- 1 www-data www-data    67 Mar  4 14:05 sess_qhbve6k4a7svu6pk0lk568jgt0
-rw------- 1 www-data www-data    67 Mar  4 13:49 sess_sh48e898i7ad14oidsph08in10
-rw------- 1 www-data www-data 30044 Mar  4 14:04 sess_uvumc2341dvtfikl27kpile46pmfbon1

(That last one in the listing looked "funny" to me.)

I first tried restarting apache2 but the sessions apparently survive that. So I just deleted them. (Don't know of another way to clear them.) Upon refreshing the browser, the phpMyAdmin login displayed and everything is working as expected.

0

I encountered this after a parse error in config.inc.php. Unfortunately, phpMyAdmin sets error_reporting(0) while reading the configuration file. Open libraries/Config.class.php, search for $old_error_reporting = error_reporting(0); and replace it with $old_error_reporting = error_reporting(E_ALL); to see what's going on. Of course you should revert this change later for security reasons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.