http://localhost/phpmyadmin does not open
404 Not Found for http://localhost/phpmyadminShort 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.
Fix it fast
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$"2Match what you see, then jump to its fix
- 1
The browser cannot connect at all, and apachectl status gives an error or reports that it is not runningApache is not runningFix - 2
Apache answers, but /phpmyadmin gives Not Found and grep finds no enabled phpMyAdmin configNo Alias maps /phpmyadmin to the phpMyAdmin folderFix - 3
/phpmyadmin exists in the config but the request is refused instead of servedThe aliased folder is outside DocumentRoot and access is not allowedFix
- 1
What does the error look like?
404 Not Found for http://localhost/phpmyadminThe 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 configtest2Fix
Fix whatever configtest reports (it prints Syntax OK when the files parse), then start Apache.
sudo apachectl start3Verify
The server answers on port 80.
curl -I http://localhost/Confirmed by httpd.apache.org
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 graceful3Verify
The login page loads.
curl -I http://localhost/phpmyadmin/Confirmed by httpd.apache.org
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.conf2Fix
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 graceful3Verify
Request the page from the machine that was refused.
curl -I http://localhost/phpmyadmin/Confirmed by httpd.apache.org
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
phpMyAdmin says the mbstring extension is missing
The mbstring extension is missing. Please check your PHP configuration.
phpMyAdmin found no mbstring module in the PHP that serves it.
3 causes, each with a fixBack end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
Application Load Balancer returns 502 for a Node.js target
HTTPCode_ELB_502_Count
An ALB returns 502 when the target gives it something it cannot use: a refused or reset connection, a connection closed mid-request, a bad response, or a header over 32 K.
4 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack 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