23

I have MySQL set up correctly on my linux computer, however I want a better way to input data into the database besides terminal. For this reason, I downloaded phpMyAdmin. However, when I try to log in to the phpMyAdmin from index.php, it doesnt do anything. It seems to just refresh the page without doing anything. I am putting in the correct MySQL username and password. What is the issue?

Here is a screen shot of what it shows after I click "go".

enter image description here

Jason
  • 15,017
  • 23
  • 85
  • 116
Braden Steffaniak
  • 2,053
  • 3
  • 25
  • 37

15 Answers15

15

This is a possible issue when the path to save php_session is not correctly set :

The directory for storing session does not exists or php do not have sufficient rights to write to it.

To define the php_session directory simply add the following line to the php.ini :

session.save_path="/tmp/php_session/"

And give write rights to the http server.

usually, the http server run as user daemon in group daemon. If it is the case, the following commands will make it :

chown -R :daemon /tmp/php_session

chmod -R g+wr /tmp/php_session

service httpd restart
User
  • 23,729
  • 38
  • 124
  • 207
Mohammad_Hosseini
  • 2,481
  • 3
  • 30
  • 53
  • 2
    But everything else works except phpmyadmin... Other parts of the website can create sessions. – Calmarius May 12 '16 at 14:26
  • 1
    There is little relation between how "other parts of the website can create sessions." The issue you have here is a fairly common one. Just provide a session.save_path location and make that folder readable to your webserver. In my case, I would do "sudo chown -R nginx:nobody /var/lib/php/session && sudo chmod -R 770 /var/lib/php/session". – Testing123 Sep 18 '17 at 03:11
4

Login fails if session folder in not writeable. To check that, create a PHP file in your web directory with:

<?php
$sessionPath = 'undefined';

if (!($sessionPath = ini_get('session.save_path'))) {
    $sessionPath = isset($_ENV['TMP']) ? $_ENV['TMP'] : sys_get_temp_dir();
}

if (!is_writeable($sessionPath)) {
    echo 'Session directory "'. $sessionPath . '"" is not writeable';
} else {
    echo 'Session directory: "' . $sessionPath . '" is writeable';
}

If session folder is not writeable do either

sudo setfacl -R -m u:www-data:rwx <session directory> or chmod 777 sudo setfacl -R -m u:www-data:rwx <session directory> -

Amadu Bah
  • 2,919
  • 28
  • 27
2

I fixed my issue on CentOS 7 with MariaDB and phpmyadmin I downloaded from offical phpmyadmin site by adding

session.save_path = "/var/lib/php/session"

to /etc/php.ini

and

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

I also restarted php-fpm and lighttpd after

Cokaric
  • 51
  • 1
  • 8
2

I am late to the game, but on Amazon linux AMI I could not log in to phpmyadmin ... it just kept refreshing the login screen with no errors.

I have fixed with below command

sudo chmod -R 755 /var/lib/php/session
Carl Binalla
  • 5,393
  • 5
  • 27
  • 46
Georage
  • 21
  • 1
1

In my case the solution was to set an Apache setting properly:

ProxyPassReverseCookiePath

This was required, because ProxyPass and ProxyPassReverse were in use, but cookie paths are not changed automatically.

It'd be great if PHPMyAdmin had shown something like session not found or anything, when password is sent with POST.

Gábor G.
  • 175
  • 3
  • 5
1

Do you have a .htaccess file in one of the parent directories that strips off index.php from the url by doing a 301 redirect?

301 redirects discard the form data and redirect you as if you didn't submit anything. So you get returned to the login page.

So you should create a local .htaccess file in the phpmyadmin directory with a single line RewriteEngine On. This will overwrite the previous rewrite rule to nothing.

You may need to clear the browser cache as Chrome aggressively caches 301 redirects.

Calmarius
  • 18,570
  • 18
  • 110
  • 157
1

In my case the hard drive was full.

Use df -h to check the space left on your hard drive, and if you want you can free some space by using the command sudo apt-get clean, which removes installation files.

I hope this will help some future users.

Pascal Goldbach
  • 977
  • 1
  • 15
  • 34
1

I ran these commands and it worked for me:

sudo service httpd restart
sudo service mysqld stop
sudo service mysqld start
pochat
  • 33
  • 5
0
  1. Try searching the web for installation or setup guides for phpMyAdmin. Look at two or three of these and make sure you have covered all the required steps. (If you have already done so, please include which guides you have followed it in the question).
  2. See if it helps to edit config.inc.php (acecoder mentioned this as well).
  3. Check if this guide is of any help.
  4. Which distro are you on? Try searching for the name of the distro you are using together with "phpMyAdmin guide" or "phpMyAdmin setup howto".
  5. If you encounter errors along the way, post the error text here, if it's short (or paste via a pastebin-like site if it's long).
Alexander
  • 9,737
  • 4
  • 53
  • 59
0

Are you sure that mysql is running? I had the same issue after doing a database import and filling up the volume containing the mysql database. After changing various permissions and clearing sessions, I tried to restart mysql (/etc/init.d/mysql restart) and it failed because the volume was full. After increasing /var and starting mysql successfully, I was able to log into phpmyadmin just fine.

John K.
  • 33
  • 4
0

If you have an error like:

Host 'host_name' is blocked because of many connection errors.

Login in your mysql as root and run the flush hosts command

1.- mysql -u root -p

2.- mysql > flush hosts

After this I was able to login again in phpmyadmin

John
  • 1
  • That's nice as a comment: "Did you have an error like 'Host 'host_name' is blocked because of many connection errors.'?" But as an answer it's a shot in the dark - and the question is from 2012 so chances are that the OP has already resolved the problem (and didn't post about it) – Erwin Bolwidt Oct 15 '14 at 08:12
  • Erwin its great if the comment sounds nice to you but it solved the problem "Cannot login to phpMyAdmin, no errors shown". If your host_name is blocked you dont get any aditional information in phpmyadmin. If you execute flush hosts in mysql you will be able to login. If the post answer is not good for you go to the next topic. – John Oct 16 '14 at 08:29
0

phpMyAdmin will show errors when login fails. If it doesn't, it means that your setup has an error.

The most likely place to check is your php.ini settings. Since there doesn't seem to be an official list of phpMyAdmin-compatible settings, it's mostly trial and error.

Make sure you have enabled the stuff that needs to be enabled. Also check that you did not enable uncommon php.ini settings (like enable_post_data_reading = Off) because phpMyAdmin assumes them to be "the usual ones".

To ease debugging, start with a clean default php.ini file then tweak them line by line to see which setting is causing the error. (Don't forget that you need to restart your server after changing the php.ini file for the changes to take place.)

Community
  • 1
  • 1
Pacerier
  • 86,231
  • 106
  • 366
  • 634
0

In my case it was due to an old Apache session. Stop Apache, clear all pending sessions in your sessions.save_path directory (example: /var/lib/php/session) and restart Apache.

Tim Visée
  • 2,988
  • 4
  • 45
  • 55
David
  • 1
0

Make sure to set a 32 chars long random key in 'config.inc.php' in the $cfg['blowfish_secret'] value. That solved it for me.

0

Didn't realize I need to restart MariaDB after modifying config.inc.php:

service mariadb restart

Otherwise at least in my case changes didn't come affect. Also make sure your php session directory is writable by webserver (typically session.save_path = "/var/lib/php/session")

Teemu
  • 91
  • 1
  • 3