localhost/phpmyadmin is giving 404 error and http://localhost in thr url is not showing any file list.

I have changed the ServerName in every conf file. Actually it was just happened recently. I was about to install laravel (a php based framework) in my local machine. It was said to change the virtualhost in apache2 configuration and so I did. But now this has created the problem.

Help me please. I am in a very bad situation.


You will need to configure your apache2.conf to make phpMyAdmin works.

sudo nano /etc/apache2/apache2.conf

Then add the following line to the end of the file.

Include /etc/phpmyadmin/apache.conf

Then restart apache

/etc/init.d/apache2 restart
| improve this answer | |

If the localhost/phpmyadmin give error 404 maybe you can check the symlink.

sudo ln -s /usr/share/phpmyadmin /var/www
sudo a2enconf phpmyadmin
sudo service apache2 reload

Please check the output when you type localhost on your browser the output is apache homepage.

| improve this answer | |
  • sudo a2enconf phpmyadmin – user993616 Oct 21 '16 at 7:33
  • sudo a2enconf phpmyadmin , ERROR: Conf phpmyadmin does not exist! This command is not running... – user993616 Oct 21 '16 at 7:33
  • I have managed to setup phpmyadmin. But localhost in the browser still giving me the same error. – user993616 Oct 21 '16 at 13:05
  • check the screen. – user993616 Oct 21 '16 at 13:06

The 404 or Not Found error message indicates that the client was able to communicate with a given server, but the server could not find what was requested.

The web site hosting server will typically generate a "404 Not Found" web page when a user attempts to follow a broken or dead link, such as when the requested file (page) is not at that URL, which will most likely mean that your phpmyadmin is not located at or symlinked to http://localhost/phpmyadmin.

I have previously come across this situation personally and my solution was actually very simple;

Copy/move phpmyadmin into /var/www or wherever you store your web files:

cp -R '/usr/share/phpmyadmin' '/var/www/'

Then create a new VirtualHost in your apache.conf file, or as I do have a .conf for each VirtualHost. Bare in mind you will have to make sure there are no conflicting VirtualHost's, a simple straight forward VirtualHost phpmyadmin.conf file;

<VirtualHost *:80>

ServerName phpmyadmin.local
ServerAdmin admin@your-email.com
DocumentRoot /var/www/phpmyadmin

    <Directory var/www/phpmyadmin>
        AllowOverride All
        Order allow,deny
        Allow from  all
        Require all granted

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Don't forget to do;

sudo service apache2 restart

You can then go one step further in your organization regarding your setup, you may notice that my ServerName is phpmyadmin.local, this the most simple thing to do and its known as local subdomains. To implement this you will need to do the following (of course choose your favorite text editor);

sudo gedit /etc/hosts

And here is my hosts file, full to the brim of local subdomains;   localhost   jack-mint   filmod.tk.local   filmod.uk.to.local   facebook-phishing.local   phishing   new.uksss.home   theystolemybaby.uk.local   theystolemybaby.uk.to   theystolemybaby.uk   theystolemybaby.uk.undo.it.local   theystolemymail.local   phpmyadmin.local   owa.local   itools.uk.to.local   facebook-phishing.local   lite.ml.local   rsync.local   babysnatchers.local   soon.local    sams.eth.local <- this is another machine on my network    kali.wlan.local <- as is this   hiawatha.monitor.local   hiawatha.local   w3schools.local   banshee.local   italk.local   wp-filmod.local   wordpress.local   wordpress4.3.local   films.local   movie-db   example-code.local   pythonscraping.local

# temp
#   italk.local <- this is also another machine on my network   wp-filmod.local <- as is this

You can literally use nearly anything you want but I guess its good practice to use 'subdomain.domain'. You can use IP addresses from your entire network, essentially what you put in the hosts file an IP address that when typed in your local browser your system will first look at your hosts file and if that URL isnt in there you will be forwarded to an external DNS. Basically this a local DNS service that works like a charm.

And then in my browser I use the URL http://phpmyadmin.local or just phpmyadmin.local

| improve this answer | |
  • I can not proceed as your first commend is giving me this error : cp: cannot stat `/usr/share/phpmyadmin': No such file or directory – user993616 Oct 21 '16 at 7:37
  • you will need to find which directory phpmyadmin is sstored in, try; sudo find / -iname 'phpmyadmin' that will find phpmyadmin (infact it may find several things and you will have to work out which one is the actual web files direcory) – Jackherer Oct 21 '16 at 11:09
  • It is in /var/www/phpmyadmin Now tell me how to resolve this issue. – user993616 Oct 21 '16 at 12:48
  • Tell me when you will be online. It would help me to sort out easily otherwise it will take too much time to make conversation over this forum. – user993616 Oct 21 '16 at 12:50
  • hey I'm online and should be online most of today I will be happy to help. – Jackherer Oct 22 '16 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.