I have typically used XAMPP on my windows PC for web development testing. This afternoon I plan to add LAMP to my Ubuntu. I would also like to try and install Apache Tomcat but I am not familiar if

  1. Can this be done in Ubuntu 12.04?
  2. Is there any solid documentation for testing and running?

I did not find anything from my searches here so if this has been asked please close. Also, if you can suggest a better tutorial for the LAMP install I would greatly appreciate it. This will be for local testing, too.


I asked this question in hopes to figure out a quality solution but it would appear all we should do is Google our questions instead of posting threads that may benefit others in the future. That being said I shall go through the following and test.

Hope this helps the next person:


There is a web server built into Ubuntu, you don't need to install anything. PHP does not ship with Ubuntu, but you can install it easily using Software Center.

How to use Python to run a CGI web server

Simply make a new directory (lets call it www_playground) enter it using the terminal. Make a new directory in the directory called cgi-bin. Now make a text file called hello.php in the cgi-bin directory. Write this into the file and make it executable:

#!/usr/bin/env php
echo "Content-type: text/html\n\n"; /* DON'T TOUCH THIS unless you know what you're doing */
<!doctype html>
<h1>Hello World!</h1>
<p>How are you? The time is <?php echo date("r"); ?>.</p>

Now, in the terminal (which is in the www_playground directory), write python -m CGIHTTPServer and ⏎ Enter. The server will start, leave it running in the terminal in the background for as long as you want.

You can now open a web browser and go to http://localhost:8000/cgi-bin/hello.php, and you should see the web page we just created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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