Getting php working with Apache on 10.04

Christie Koehler christiekoehler at
Sun Oct 2 06:02:08 UTC 2011

On Sat, Oct 1, 2011 at 7:25 AM, Richard C. Steffens <rsteff at> wrote:
> in /etc/apache2/httpd.conf. I did just that but when I put localhost in
> Firefox's address bar I still get the download window. However, if instead
> of just http://localhost I enter http://localhost/index.php I get my
> index.php page.

The notice about ServerName was probably just a warning and not
related to the issue you're having.

You should be able to do the following to get a list of modules that
are active:

sudo apache2ctl -M

If you don't see something like "php5_module" in the list, then do:

sudo a2enmod php5

(If the above fails, you might need to re-install the Ubuntu package
libapache2-mod-php5. If it says the module is already enabled,
continue on.)

Now you should have something similar to the following in

    <FilesMatch "\.ph(p3?|tml)$">
	SetHandler application/x-httpd-php

This is the code that tells Apache how to handle .php files (run them
through the php mod, rather than sending them to the browser for

Restart apache (/etc/init.d/apache2 restart) and you should be good to go.

Also, FWIW, if find this to be a better tutorial on how to get LAMP up
and running on Ubuntu:


Christie Koehler
(503) 928-4133
christiekoehler at

Celebrate peace. Celebrate non-violence. Go vegan.

More information about the Ubuntu-us-or mailing list