PhpMyadmin leads to a 404

| SYSTEM INFORMATION||
Operating system Rocky Linux 9.7
Webmin version 2.621
Usermin version 2.521
Virtualmin version 8.0.0 Professional
Authentic theme version 26.22

Per the following topics:

and

https://forum.virtualmin.com/t/integrate-phpmyadmin-into-the-virtualmin-gui-2/136140/57

in particular:

… i deleted my top level version of phpmyadmin (on the hostname domain) - then reinstalled it and selected “use as default”.

To my joy, the “manage in phpmyadmin” button now shows on one of my servers, but sadly when clicking on it, the result is “file not found” / 404

myhostdomain .example/phpmyadmin/pma-login-4534534sdfsdfsdsdfsdfsdf51381f8b65.php?n=adffbdassdfsfdfgsfgsdfgs

(I have edited the exact url above for privacy, but you can see what i am saying.)

I see this

This page isn’t working
**myhostdomain ** is currently unable to handle this request.
HTTP ERROR 502

when i reload: The result displays as “file not found”

Note:
in the GUI if i hover over the button, i get a slightly different URL to the one that loads in the browser
myhostdomain dot com :123/virtual-server/login_phpmyadmin.cgi?dom=176760023423423423427&dbname=websiteuser_wpdb1

So any suggestions? So close!

I have install phpmyadmin on the hostname account and clicked use default. Result: the “manage in phpmyadmin” button appears but leads to a 404

If I install a singular phpmyadmin on a virtual server - also leads to a 404

This is a new webmin server - do I need to ‘apt-get install phpmyadmin’ first ?

Is there some updated documentation I can follow? I don’t see anything here: Documentation | Virtualmin — Open Source Web Hosting Control Panel

@Ilia suggested it was a “wrong site showing up” but in fact I just get simply “file not found”

I am wondering if I should be installing via ‘apt-get install phpmyadmin’ in webmin first as a rep-requisite ?

Which is what happens if the wrong site is the one being queried and there is no phpmyadmin installed on that domain.

Absolutely not. That will break all of your VirtualHosts, among other things. (The deb package is not setup for VirtualHost usage, and Apache is either in VirtualHost mode or non-VirtualHost mode.)

1 Like

To be clear, you almost certainly have a mix of * and IP-based VirtualHosts (or misconfigured IPv6 or something else that leads to Apache preferring the wrong site…). Apache does not consider ServerName if there is a more specific IP match, IP always takes precedence over the non-specific * in a VirtualHost. This is very unintuitive, but goes back to Apache originally only supporting IP-based VirtualHosts (as there was no Host header in early versions of the HTTP standard).

Do you have any suggestions as to how I could resolve this ?

Follow the steps in that document:

If you see a mix of IP (whether IPv4 or IPv6) and * VirtualHosts, that’s your problem (or, at least, it is a problem, if not this specific problem). You can either use all * or all IP, you can’t have a mix and match, because the IP will always win and the * VirtualHost will never be shown.

OK thank you that was helpful. These are migrated WP sites on a fresh Rocky9 server, so I would have hoped that the default apache set up would have collected the right IPs however, I can see now there’s a few manual jobs to do prior to and after import.

Meanwhile, so all port 80 and 443 are set to * since there are only a few sites on this server all sharing the same ip. To see if it would help, I set them all to the IP address, restarted apache and then went to several of the virtual servers and “manage database” > click the button manage with phpmyadmin > the same result

The url displays as
https:// myhostname .example /phpmyadmin/pma-login-7e8longhash.php?n=d8alonghashbb9fb

First:

This page isn’t working

myhostname is currently unable to handle this request.

HTTP ERROR 502

Then if I reload that page,

“file not found”

NB going directly to “https:// myhostname .example/phpmyadmin/” works.
Also, all sites load correctly

FYI
Network interface for virtual addresses is set correctly
Default virtual server IPv4/IPv6 address: is From Network Interface

Defaults for new domains
Address format for Apache virtual hosts : this setting is missing from my interface - perhaps it has moved?

Now you need to look at the log for this domain to see why you have a 502. The client has no useful information about why where is a server error.

502 is a bad gateway error, which probably means the PHP-FPM server isn’t responding as expected.

I see a lot of Got error ‘Primary script unknown’

Perhaps a conflict between etc/php-fpm and remi version installed here:
/etc/opt/remi/php83/php-fpm.d/176123419.conf file (this is for the hostname pool)
We are using Remi PHP 8.3 (php83-php-fpm). The generic/standard php-fpm service is disabled/failed by design since it’s not being used.
I do have php83 and php82 installed, however not currently using 82.

The 502 error seems to be a path mismatch between where the migration script placed the pool configs and where the Remi PHP-FPM binary expects to find them…

No. It’s entirely normal to have multiple PHP versions, including the system default one in /etc. None of the other PHP-FPMs matter, as long as the one for the domain where phpmyadmin is installed is running and able to answer.

I’m not sure what this means.

“Primary script unknown” means the script can’t be found. So, what path is it actually trying to load? Look at the access log.

If you wrap URLs in backticks (`) you don’t have to break it up with spaces, and it’s easier to read.

At this point, i think I need to see the relevant Apache VirtualHost sections, so I can understand what’s happening. Wrap it in triple backticks (```), so it doesn’t get chewed up.

The final outcome of this, for anyone who is also facing this - is that we have set up a basic auth onto the phpmyadmin setup to provide an extra layer of defence. This was interferring with the launching of phpmyadmin - but was failing silently. It took a lot of effort to find out what the 404 was due to - the logs were fairly oblique.

@Ilia came up with a great new solution to solve this - a tweak to the phpmyadmin script that checks for and allows passthrough of basic auth. I believe this will be care at some point but the patch is here:

webmin patch https://github.com/virtualmin/virtualmin-gpl/commit/bdba751

Thank you team! Another amazing improvement.

2 Likes

What and how did you see this up?

I would suggest to consult the docs and / or web search to do that. It really depends on your environment set up too and so your methods to set it up might be different than mine.

@Ilia might perhaps introduce this as a feature option ?

For me, I installed it on Rocky9 server and set the basic auth to work regardless of the virtual server. Most of my websites are self managed, so i don’t need to worry about client access - therefore i simply set a master username and password, but you could create unique ones - just depends how much time you have and how paranoid ;-0

I’m pretty sure Ilia has said he’s adding automation of this (basic auth of phpmyadmin).

Oh good - nice to know I added something useful :slight_smile:

Implemented here:

4 Likes