17

I am getting this error on export of my database in adminer. Error: Invalid CSRF token. Send the form again. If you did not send this request from Adminer then close this page. Need Help

RamanSall
  • 355
  • 1
  • 4
  • 10

11 Answers11

13

Try this!

chgrp nginx /var/lib/php/session

The problem may cause by session save path not writable. I have faced the same problem and I fixed it by above command. I use nginx but if you use another web server, just change it. Hope this helps!

wdetac
  • 2,712
  • 3
  • 20
  • 42
12

The problem for me was that the session cookie had the secure flag, while I was accessing adminer via http only (not https).


Our nginx configuration had

fastcgi_param HTTPS on;

which I had to remove.

cweiske
  • 30,033
  • 14
  • 133
  • 194
6

Check that /var/lib/php/session exists and that nginx can write to it.

Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
4

Your session should contain a CSRF token to prevent a CSRF attack. This message means that you either have no token stored or your token is not the same as that generated by your server. I assume that you don't have a writable path configured in your php.ini where you can store the session. Please check if you have set session.save_path in php.ini to a writable path.

Epi
  • 322
  • 2
  • 15
4

Find session.save_path in phpinfo (/var/lib/php/session for Centos) and change the mode:

chmod -R 777 /var/lib/php/session

done!

Sinan Eldem
  • 5,564
  • 3
  • 36
  • 37
3

What setup are you using? I had this happen with nginx + php-fpm, and after I did a diff of php.ini of one machine where adminer worked and one where it didn't, and found out that I needed to blank out the value for session.cookie_domain.

4oo4
  • 245
  • 3
  • 8
2
  1. Create a phpinfo.php file

    <?php phpinfo(); ?>

  2. Find real session save path

    /var/opt/remi/php72/lib/php/session

    enter image description here

  3. Change directory permission

    chmod -R 0777 /var/opt/remi/php72/lib/php/session

0

Sometimes it happens on previous PHP versions, which is not very important. You can refresh the page or reopen it, this will fix it.

Kristina
  • 261
  • 2
  • 13
0

It happened to me an hour ago. Check you have enough space in /var. I cleaned it and it works again.

syndrael
  • 158
  • 1
  • 3
  • 9
0

https://sourceforge.net/p/adminer/bugs-and-features/174/#429b : Yes this problem is caused by session savepath not being writable, add this line to the top of your file, will work if your host allows it

ini_set( 'session.save_path', 'path/to/writable/directory/' );

Hamid Shariati
  • 546
  • 6
  • 18
0

Check if your filesystem is not full.

df - kh

It can be a explanation of not be able to write on it.

Ru Chern Chong
  • 3,692
  • 13
  • 33
  • 43
Julien
  • 41
  • 3