# Running a web test server with Ubuntu

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.

-
You may wish to check this out: help.ubuntu.com/community/Tasksel –  Geppettvs D'Constanzo Feb 26 '13 at 16:21
I think it will be easier for you to not focus to much on lamp, but focus on getting apache running on your desktop. I found that to be easier. –  don.joey Feb 26 '13 at 17:28
@Private Do you have a suggestion then on the best way to just install Apache? –  Matt Feb 26 '13 at 17:35

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


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.

-