Fixing Common Problems with LAMP on Ubuntu

May 5, 2012 by
Filed under: HowTo, linux, Ubuntu, web development 

There are a few common problems that people run into after installing LAMP on Ubuntu. In this post I'll show how to fix a few of those problems. If you don't already have LAMP set up, please see How To Install LAMP on Ubuntu.

Fixing phpMyAdmin

One common error that some people make is that they forget to mark apache2 during the phpMyAdmin configuration. When this happens you'll get a 404 Not Found error when trying to navigate to http://localhost/phpmyadmin/.

phpMyAdmin Not Found

If this happens, enter the following terminal command.

Affiliate Link
sudo dpkg-reconfigure phpmyadmin

You will be prompted about reinstalling the database. Accept the default of "No" and hit <Enter>.

Don't reinstall phpMyAdmin database

Make sure to then mark apache2 by having the cursor next to apache2 and then hitting <Space> to mark it with a *, then hit <Enter>.

Reconfigure phpMyAdmin for Apache

You will then need to reload Apache.

sudo service apache2 reload

You should now be able to load http://localhost/phpmyadmin/. If you're still seeing the 404 Not Found error, then you will need to clear your web browser cache and try again.

phpMyAdmin login screen

Click to enlarge

Fixing the Apache fully qualified domain name

During the above steps you may have seen an error message like this when reloading Apache.

apache2: Could not reliably determine the server's fully qualified domain name,
using for ServerName

This doesn't seem to cause any problems for me, but if you don't like seeing that error, you can fix it with this command.

echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

Then reload Apache with

sudo service apache2 reload

Remove LAMP?

Is your LAMP setup a mess and you just want to start over? Follow these instructions to Remove LAMP from Ubuntu.


10 Responses to “Fixing Common Problems with LAMP on Ubuntu”

  1. ar says:

    Great Tutorial

  2. Thomas says:

    I was getting the 404 error for phpmyadmin as well, and what worked for me was to add the line "Include /etc/phpmyadmin/apache.conf" in the /etc/apache2/apache2.conf (as per

  3. pavan says:

    Hi Everyone,
    I get localhost page i.e., "It Works"
    But i can't access localhost/phpmyadmin page , It say 404 error.
    Help me

  4. @Samanta, I don’t think this a is a error message or at least an error message that you should be worries about. This is just a log of when the apache daemon was restarted. Nothing nasty.

  5. Samanta says:

    Hi I think I have a problem when I reload apache this appears in the error.log

    [Wed Jul 18 13:44:58 2012] [notice] Graceful restart requested, doing restart
    [Wed Jul 18 13:44:58 2012] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.2 with Suhosin-Patch configured -- resuming normal operations

    And this when I restart Apache
    [Wed Jul 18 13:50:44 2012] [notice] caught SIGTERM, shutting down
    [Wed Jul 18 13:50:45 2012] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.2 with Suhosin-Patch configured -- resuming normal operations

    this didn't appear before =(

  6. cliff says:

    the and was missing from my post (a space instead). don't put the p inside the < in the quotes.

  7. samir says:

    Local host shows blank php page in browser but html page are working fine.It shows no error,but just blank page.

    • cliff says:

      I had this problem too, a tutorial I used was wrong. Do not put and inside double quotes. The example said,

      echo " This is a PHP line ";

      When corrected to

      echo "This is a PHP line";

      it works. I'm still new to this, but that change fixed the blank page, displays now.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>