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?

meysam
  • 1,754
  • 2
  • 20
  • 30

10 Answers10

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.

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • 2
    Thanks Isaac, I had the same problem with nginx and changed that with - chown root:nginx session – Ilian Andreev Mar 06 '14 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 Aug 12 '14 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 Nov 23 '14 at 16:38
  • Thanks! You saved me a lot of time! – randomizer Oct 03 '16 at 18:52
  • Thanks. after 2 days.. found the perfect solution – Ketan Kotak Jan 11 '18 at 19:29
  • In my case the following answer was solving the problem: https://stackoverflow.com/questions/27537617/phpmyadmin-fatal-error-call-to-undefined-function 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` – user2641103 May 09 '18 at 11:03
  • It's indeed a permission issue. In my issue, it was not only the folder but also files in it. Solve by `rm -rf /var/lib/php/sessions/*` – Kevin Lemaire Oct 22 '19 at 12:33
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

itz_nsn
  • 648
  • 1
  • 8
  • 13
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
Tobias Beuving
  • 630
  • 6
  • 18
  • 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 Apr 25 '17 at 09:03
  • 2
    This works every time, dont forget to restart apache when you've installed php-mbstring – Stephen Apr 28 '17 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.

Alfred Huang
  • 17,654
  • 32
  • 118
  • 189
  • 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 Feb 21 '19 at 20:57
  • Sorry, works the same with nginx as the user. Should try to be more clear for whoever comes next. – KGVT Feb 21 '19 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.

BlissSol
  • 374
  • 10
  • 23
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.

Jpsy
  • 20,077
  • 7
  • 118
  • 115
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.

Spikolynn
  • 4,067
  • 2
  • 37
  • 44
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.

cbmckay
  • 466
  • 7
  • 19
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.

Bachsau
  • 1,213
  • 14
  • 21