Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
What's the easiest way to set up a LAMP stack?

I would like to install Apache and PHP on my new machine, running Ubuntu 11.10, but I can't see either of them listed in the software centre. What do I need to do to install them? So far as I know, any version will do. I just need to find out how to install them in the way I am least likely to get wrong.

share|improve this question

marked as duplicate by Lekensteyn, Jorge Castro, Bruno Pereira, jrg, htorque Jan 18 '12 at 23:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 1 down vote accepted

Search for synaptic package manager in the Software Center and install it. Fire it up and then search for apache2 and php5-cli. Install both. Also install libapache2-mod-php5 so you can execute php scripts on your apache server. Good luck!

share|improve this answer

LAMP Linux, Apache, MySQL, PHP are external packages. Each package can be configured and installed separately. You may use the following steps to install manually.

Open your terminal and type:

sudo apt-get install php5 mysql-server apache2

The above command will install latest version of PHP which is version 5 and mysql-server with apache http server 2.

You will be prompted in terminal to give a password for your MySQL "root" user

After the the installation finished check Apache is working. Open your favorite browser and type localhost in the address bar. You should see a message "It works!"

Also check if php is working or if not,

Open your terminal and type: sudo gedit /var/www/info.php

copy and past the following info text

<?php
phpinfo();
?>

Save and exit.

Restart apache:

sudo service apache2 restart

open your browser and type:

localhost/info.php

and you will see the PHP info page.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.