phpMyAdmin Gives 404 on localhost – Here’s the Fix

localhost/phpmyadmin returns 404? Fix the missing Apache include on Ubuntu, XAMPP path issues, and alias configuration – with exact commands.

Last updated: July 2026

You installed phpMyAdmin, open http://localhost/phpmyadmin, and Apache answers 404 Not Found. The cause is almost always the same: Apache doesn’t know phpMyAdmin exists, because its config file was never included.

Fix 1: Include phpMyAdmin’s Apache config (Ubuntu/Debian)

The package ships /etc/phpmyadmin/apache.conf, but on some installs it never gets linked into Apache:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo systemctl reload apache2

That config defines the crucial line:

Alias /phpmyadmin /usr/share/phpmyadmin

Reload http://localhost/phpmyadmin — for most people this is the whole fix.

Fix 2: Reconfigure the package

If the file structure looks odd or you skipped the web-server question during install:

sudo dpkg-reconfigure phpmyadmin
# select "apache2" with SPACE (the asterisk must appear), then OK
sudo systemctl reload apache2

The classic mistake in that dialog: highlighting apache2 but pressing Enter without Space — nothing gets selected and no config is written.

Fix 3: XAMPP – wrong URL or moved folder

On XAMPP, phpMyAdmin lives inside the XAMPP directory and is served at the same URL. A 404 there usually means Apache is running from a different XAMPP instance than you think, or the phpMyAdmin folder was renamed. Check C:\xampp\phpMyAdmin exists and that you’re hitting http://localhost/phpmyadmin on the port Apache actually uses (http://localhost:8080/phpmyadmin if you moved it).

Still 404? Two quick diagnostics

# is phpMyAdmin actually installed, and where?
ls /usr/share/phpmyadmin

# does Apache know the alias?
apache2ctl -S 2>/dev/null | head
grep -r "phpmyadmin" /etc/apache2/ --include="*.conf" -l

If ls fails, the package isn’t installed (sudo apt install phpmyadmin). If grep finds nothing, apply Fix 1. In nginx, there is no alias mechanism — symlink it into your web root instead: sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin.

Once you’re in but can’t log in, that’s a different problem — see resetting a forgotten phpMyAdmin password.

Comments

comments