LAMP on Ubuntu 10.10

2 minute read

I recently installed Ubuntu 10.10 on my laptop and one of the things I had to set up  Apache, Mysql and PHP for development purposes.  I wanted to note down the steps I took to set this up for future reference.

Install tasksel (if not already installed) by opening up a command prompt and typing in the following command:

sudo apt-get install tasksel

Once tasksel is installed, type in the following command: sudo tasksel Select the “LAMP Server” option You will be asked to enter a password for  MySQL (don’t leave this blank) Let the installation finish! Once the installation is finished, open up a web browser window and type the following into the address bar: http://localhost/ – If apache was installed correctly, you will see a message stating that “It works!”.

Configure Apache User Directories

In a command prompt, type the following command:

sudo a2enmod userdir

Restart apache by typing in the following command:

sudo /etc/init.d/apache2 restart 

Note: you can also use sudo service apache2 reload

Create a the public_html directory on your home folder and if not already set, make sure the permissions are set to 755 (using chmod).

Configure Apache mod_rewrite module

Type in the following command:

sudo a2enmod rewrite

Restart apache:

sudo /etc/init.d/apache2 restart

Test PHP Installation

cd into your public_html folder and create a file called info.php and enter the following code:

<?php phpinfo(); ?>

If all is set up and running, you have successfully tested PHP!

Note: If when you try to access the info.php file your browser asks you to download it, you will have to do one additional step. Apparently Debian and Ubuntu by default disable php scripts from running in a users home directory (apparently this is an issue with Ubuntu 10.10 but does not appear in Ubuntu 10.04).  To  get php scripts to work, follow these additional steps:

Edit file:

sudo vim /etc/apache2/mods-available/php5.conf

Comment out the following lines:

php_admin_value engine off

Save the Changes Restart apache with the following command:

sudo /etc/inti.d/apache2 restart

You should now be able to view your test php file.

Leave a comment