Home >Fix session expire when using adminer.php

Fix session expire when using adminer.php

  • As a programmer in general and a Magento developer in particular, you will often have to access to the database to check, configure or just to test one feature.

There are many ways to access to the database and 1 tool I use frequently is adminer.php.

All activities with adminer are pretty easy, what we need is an extremely basic, compact interface.

It all seems good to adminer, I have nothing to complain.

But suddenly one day, it (referring adminer on my server) suddenly … could not log in, even though I filled user and password properly.

login adminer 1

 

or one similar type of error:

login adminer 2

Reasons: PHP cannot save session.

Solution:

1. Create a file named info.php in your web root, add code:

<?php phpinfo(); ?>

2. Check php info on browser, eg:

example.com/info.php.

Screen of phpinfo show up, then search

“session.save_path”

Here is the result:

phpinfo

3. As you can see, session files are stored in C:\xampp\tmp, because I am using localhost, each server will be different. Normally it would be:

/var/lib/php/session

and we assume that it would be:

/var/lib/php/session.

4. Use terminal or putty to access to ssh server, cd to /var/lib/php/, we will have 2 possible cases:

  • Folder session does not exist.
  • Session directory exists and was set to wrong permission

In the first case, we need to create and set the correct permission:

mkdir session

apache server:

sudo chown -R www-data:www-data /var/lib/php/session

nginx server:

chown -R nginx:nginx /var/lib/php/session

Or if you use another user to run server:

php -i | grep USER //check php user
groups username //check group
chown -R username:groupname /var/lib/php/session

Finally, we obtain write and read authorization on folder:

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

Access to

example.com/adminer.php

and login will be successful.

Good luck! 🙂

 

If you get any trouble, you can contact us via our email: support@bsscommerce.com or Skype: support.bsscommerce

 

< Previous Post
Next Post >
+ posts