Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

http://localhost/phpmyadmin does not open

Error404 Not Found for http://localhost/phpmyadmin

Short answer

The URL /phpmyadmin only works if Apache runs and has an Alias from /phpmyadmin to the phpMyAdmin folder, with access allowed for that folder. Check that Apache is running, then search its config for phpmyadmin. If nothing is found, add the Alias in a small config file and enable it.

  • Applies to phpMyAdmin 5.2, Apache 2.4, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask Apache whether it is running, and whether any enabled config mentions phpMyAdmin. The answers split the causes below.

    sudo apachectl status
    grep -R -i "phpmyadmin" /etc/apache2/ | head
    dpkg -L phpmyadmin | grep -E "apache.conf|^/usr/share/phpmyadmin$"
  2. 2Match what you see, then jump to its fix

    1. 1The browser cannot connect at all, and apachectl status gives an error or reports that it is not runningApache is not runningFix
    2. 2Apache answers, but /phpmyadmin gives Not Found and grep finds no enabled phpMyAdmin configNo Alias maps /phpmyadmin to the phpMyAdmin folderFix
    3. 3/phpmyadmin exists in the config but the request is refused instead of servedThe aliased folder is outside DocumentRoot and access is not allowedFix

What does the error look like?

  • 404 Not Found for http://localhost/phpmyadmin
  • The browser cannot connect to localhost

Cause 1 of 3

Apache is not running

1Check

apachectl status needs mod_status, so a systemd view is also useful. A syntax error in the config stops Apache from starting.

sudo systemctl status apache2 --no-pager
sudo apachectl configtest

2Fix

Fix whatever configtest reports (it prints Syntax OK when the files parse), then start Apache.

sudo apachectl start

3Verify

The server answers on port 80.

curl -I http://localhost/

Confirmed by httpd.apache.org

Did this fix it?

Cause 2 of 3

No Alias maps /phpmyadmin to the phpMyAdmin folder

1Check

The Ubuntu package ships /etc/phpmyadmin/apache.conf. Apache only uses a config that is enabled (linked in /etc/apache2/conf-enabled). The first command shows what is enabled, the second shows where the package put its files.

ls -l /etc/apache2/conf-enabled/
dpkg -L phpmyadmin | grep -E "apache.conf|^/usr/share/phpmyadmin$"

2Fix

Add an Alias that points to the package folder, allow access from this machine only, enable the file and reload Apache gracefully. A request path that starts with /phpmyadmin is then served from that folder.

# /etc/apache2/conf-available/phpmyadmin-local.conf
Alias "/phpmyadmin" "/usr/share/phpmyadmin"
<Directory "/usr/share/phpmyadmin">
    Require ip 127.0.0.1
</Directory>

sudo a2enconf phpmyadmin-local
sudo apachectl configtest && sudo apachectl graceful

3Verify

The login page loads.

curl -I http://localhost/phpmyadmin/

Confirmed by httpd.apache.org

Did this fix it?

Cause 3 of 3

The aliased folder is outside DocumentRoot and access is not allowed

1Check

Apache checks the target of an Alias against its own access rules, so a folder outside DocumentRoot needs an explicit Require line. A Require all denied, or an ip list that leaves out your address, blocks it.

grep -R -n -i -B2 -A6 "phpmyadmin" /etc/apache2/conf-enabled/ /etc/phpmyadmin/apache.conf

2Fix

Make the Directory block for the phpMyAdmin folder allow your address, then reload.

<Directory "/usr/share/phpmyadmin">
    Require ip 127.0.0.1 192.168.1
</Directory>

sudo apachectl configtest && sudo apachectl graceful

3Verify

Request the page from the machine that was refused.

curl -I http://localhost/phpmyadmin/

Confirmed by httpd.apache.org

Did this fix it?

How do I stop it coming back?

  • Install phpMyAdmin from the package, then check the page once right away.
  • Keep phpMyAdmin reachable from localhost or a VPN only; never allow the whole internet with Require all granted.
  • Run apachectl configtest before every reload.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Back end

CodeIgniter 4 cannot write its cache files

CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/

CodeIgniter 4's file cache needs a cache directory that the web server can really write to.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.