phpmyadmin token mismatch for long time idle
Asked Answered
N

12

30

I installed phpMyAdmin 4.0.4.1 on my local develop enviroment, I set auth_type to config. Also I provide authentication requirements by this settings:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['password'] = 'somepassword';

But after a while that it is idle, if I click on any link of it , it shows me an error token mismatch, Is there any way that I increase its TTL? or make it alive permanently?

enter image description here

Above picture shows error.

Newhall answered 6/8, 2013 at 9:33 Comment(1)
seems to be a known bug with phpMyAdmin >= 4 : Token mismatch error on every actionSelwyn
A
43

I solve this annoying problem by following instructions below:

  1. open /etc/php5/apache2/php.ini
  2. find ;session.save_path = "/tmp", this line may look also like this ;session.save_path = "/var/lib/php5"
  3. remove first semicolon from this line
  4. restart apache by executing sudo service apache2 restart

FYI: I work under Ubuntu 12.04 with apache2, php5, phpMyAdmin 4.0.5 so for different systems and servers file path may be a little different.

In case of any troubles check if directory from step 2. is writable for server.

Good luck.

Anabiosis answered 29/9, 2013 at 22:22 Comment(7)
Thanks for the tip. I had thought /tmp was the default already (I am also on ubuntu 12.04), so I got session_save_path() to dump the path which is turned out to be /var/lib/php5. Now my question is, why does moving it to /tmp instead of /var/lib/php5 help us/make it work?Bugger
I don't know but the rights are probable cause of this problem. Check the rights for /tmp and /var/lib/php5.Anabiosis
drwxrwxrwt 35 root root 4096 Nov 4 14:03 tmp/ and drwx-wx-wt 2 root root for /var/lib/php5, so it may be the lack of public read. What does t instead of x mean?Bugger
I'm sorry but I have no idea how to solve your problem. If I were you I would try with different permissions sets (linux-tipps.blogspot.com/2008/07/directory-rights-in-linux.html).Anabiosis
Theres no problem, just thought I would link this text for the 't'. "If the text bit is set (chmod o+t), files in the directory can only be deleted by their owner, not the group. But they can still be overwritten, if the files permissions allow that. So it's no real protection." So it appears that in both those directories, only the owner of the files can delete them.Bugger
@Bugger Ubuntu has a cleanup script in /etc/cron.d/php5 which deletes files in /var/lib/php5: changing session.save_path bypass that cleanup scriptSlavish
I'll just add to check if the dir exist and is writable. That solved my issue.Externalism
G
9

in file libraries/common.inc.php

line 1076
delete this part

 /*
 * There is no point in even attempting to process
 * an ajax request if there is a token mismatch
 */
 if (isset($response) && $response->isAjax() && $token_mismatch) {
    $response->isSuccess(false);
    $response->addJSON(
        'message',
        PMA_Message::error(__('Error: Token mismatch'))
    );
    exit;
}
Gabbert answered 8/10, 2014 at 3:58 Comment(3)
Better to set $token_mismatch to false right after it is tested (about line 487) after the line '$token_mismatch = ($_SESSION[' PMA_token '] != $_REQUEST['token']);' (after the the of the IF statement)Doubler
beware, the token is there for a reason. Ignoring it will open up a range CRSF vulnerabilities: wiki.phpmyadmin.net/pma/…Watford
Where did you find libraries/common.inc.phpNedry
Z
4

I had to turn my cookies on in my browser and it worked for me. (Using MAMP on OSX)

Zed answered 13/1, 2014 at 2:36 Comment(0)
C
3

For me this seemed to be caused by my root partition being full up, and I guess this error was triggered by php being unable to write to the session directory.

Clipclop answered 5/12, 2013 at 11:28 Comment(0)
S
2

After doing all that was recommended here and in other places with no success, I found out that my /tmp was full.

To check it, just run from command line: df

It reports file system disk space usage.

Sorci answered 9/1, 2014 at 22:19 Comment(1)
After running df command, i got to know that my file system dev/xvda1 was used 100%.Armyn
B
2

In my case I had to remove some files to make some space in this directory (\tmp) and the error was gone for now.

Bespread answered 22/2, 2016 at 9:13 Comment(0)
C
2

Clearing your browser cache then it will work.

Cayuse answered 10/5, 2018 at 4:50 Comment(0)
P
1

To stop this issue, delete the "tmp" folder and make a new one called "tmp" or just clear the content.

Peden answered 19/12, 2015 at 6:25 Comment(0)
B
1

Try using another browser ex IE if it works then remove suspected chrome extensions . Forr me pageXray was the problem.

Bantling answered 9/10, 2019 at 4:31 Comment(0)
L
1

ISSUE RESOLVED - I just cleared the browsing history and data for last 7 days. It solved the problem for me. Try it.

Larval answered 26/12, 2019 at 9:22 Comment(0)
D
1

I was spend my 2-3 days to solve this problem .. on Stack overflow but i didn't got any working solution for my case.. but finally.. I solve this annoying problem i was running phpmyadmin from localhost using chrome but after running from firefox.. PROBLEM IS GONE..

so.. I think that was cookies problem not PMA so.. you should try with any other browser..

Derogate answered 17/3, 2021 at 13:27 Comment(0)
R
1

I fight hours, but I've resolved the problem in this way: First I had a disk space problem where server was running; so I clean the disk to free space, but nothing happen! Then I try to remove completely xampp folder and copy there a working copy of it... nothing of nothing! Reinstall xampp restoring sites but phpmyadmin don't go away from this problem: so, finally I understand the problem was external! So the first thing I've tried with another browser... miracle!!! it works again!!! So I've completely reinstalled chrome and everything is working like before!!! That's all. Excuse me for so bad english!

Reflective answered 18/4, 2024 at 16:9 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.