Installing PHP5 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 php5
sudo apt-get install libapache2-mod-php5
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/
To configure URL rewrite, you will need to install the rewrite module for the Apache server:
sudo a2enmod rewrite/etc/init.d/apache2 force-reload
or
sudo apache2ctl restart
Adding extra Repositories on Ubuntu
Repositories on Ubuntu are the locations that you can download software from. As a general rule, the default repositories don’t contain the right locations for most software packages that you’ll want to install. You will want to open up the /etc/apt/sources.list file, find and uncomment the following lines
deb http://us.archive.ubuntu.com/ubuntu dapper universe main restricted universe
deb http://security.ubuntu.com/ubuntu dapper-security universe
Note that if you are using a different version than Dapper Drake (6.06), you will probably see a different name there, something like breezy or edgy.
Once you are done adding the repositories, you’ll need to run this command:
sudo apt-get update
(Thanks to Gregg in the comments for catching that)
0 Comments