Subscribe to How-To Geek

Recommended: Click Here to Run a Free Scan for Common PC Errors   [Sponsored Link]

Installing PHP4 and Apache on Ubuntu

If you are doing any kind of PHP development, you'll almost always be using Apache along with it. Here's the quick and easy way to get PHP up and running on your Ubuntu box.

First, you'll want to add the extra repositories to Ubuntu's sources.list file.

From a command shell, you will run the following commands:

sudo apt-get install apache2

sudo apt-get install php4

sudo apt-get install libapache2-mod-php4

sudo /etc/init.d/apache2 restart

Note that if apache is already installed you can omit the first line. Your web files will now be found in /var/www/

Note that this is nearly the same as installing PHP5, which is the latest version.

The Geek is the founder of How-To Geek and a geek enthusiast. When he's not coming up with great how-to articles, he's probably writing at his personal blog. This article was written on 09/14/06 and tagged with: Ubuntu, Adding Software, SysAdmin, PHP

Comments (3)

  1. supermansghost

    php4 isn't going to be supported after the end of this year, I think

  2. The Geek

    Yes, that's correct, but a ton of people still use it.

  3. Bryce

    i ran all the commands in terminal on Ubuntu 7.10 and it asked for my password then it said couldn't find package apache2 , what should i do


Leave a Comment




Leave your friendly comment here. If you have a computer help question, leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Copyright © 2006-2008 HowToGeek.com. All Rights Reserved.