Fix phpMyAdmin Fails to Set Cookie

1. Error content

In version 7.9 of Pagoda, the panel access function of phpMyAdmin is provided, that is, if the panel is http://1.1.1.1:8888, then it can be accessed through http://1.1.1.1:8888/phpmydmin, And you need to log in to the panel in advance.

This function increases security, so that there is no need to open a separate port for phpMyAdmin. However, I have enabled panel SSL and successfully encountered an error when logging in:

phpMyAdmin failed to set session cookie. Maybe you are using HTTP instead of HTTPS to access phpMyAdmin.

That is to say, you need to match the HTTP/HTTPS before and after, and you can log in successfully.

2. Solution

You only need to choose one of the following four options.

2.1, close panel SSL

If you don't want to bother, you can just turn off the panel SSL directly, but it will lead to a decrease in security, so it is not recommended.

2.2. Change phpMyAdmin port

Pagoda seems to reverse proxy 888 port directly, so you can:

  1. First change the HTTP port to something other than 888
  2. Open the HTTPS port and change it to 888
  3. Close the HTTP port

After actual measurement, this solution can be perfectly solved most of the time.

2.3, set the absolute path

Modify the phpMyAdmin path

config.inc.php

turn up:

PHP
1
$cfg['PmaAbsoluteUri'] = 'https://.../...';

Add it manually if not.

If your phpMyAdmin is now accessed through https://pma.com/my_pma_login/, set it to:

PHP
1
$cfg['PmaAbsoluteUri'] = 'https://pma.com/my_pma_login/';

The problem can be solved perfectly.

Modify the phpMyAdmin path

config.inc.php

turn up

PHP
1
$cfg['Servers'][$i]['auth_type'] = '...';

changed to

PHP
1
$cfg['Servers'][$i]['auth_type'] = 'cookie';

But it seems that the default is Cookie, maybe someone messing with this will also cause errors

2.5, set the reverse proxy header

If you set up a reverse proxy for yourself, you can try to add:

Nginx
1
2
proxy_set_header Cookie $http_cookie;
proxy_cookie_domain a.com b.com;

a.com is the domain name after the reverse proxy, and b.com is the original domain name.

Fix phpMyAdmin Fails to Set Cookie

https://blog.tsinbei.com/en/archives/697/

Author
Hsukqi Lee
Posted on

2023-05-18

Edited on

2023-05-18

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet