httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <>
Subject [users@httpd] Re: Need an example of how to use Apache Server 2.2.
Date Fri, 27 Dec 2013 07:10:53 GMT
On Tue, 24 Dec 2013 17:55:32 -0500, Frederick Miller wrote:

> I need an example of a simple application and how to set it up on Apache
> 2.2.  I'm running Windows XP, and I've read all the documentation.  I've
> put some Web apps under the htdocs folder, but they just show the source
> html and don't actually run the application.  I'd like to see an example
> that is more than just HTML, what folder to copy it into, and what the
> expected output is.  I've done JSPs and Servlets with Tomcat, but I'm
> new to Apache Server 2.2.  Thanks.

This is going to be long. For those of you used to reading my comments on 
the Apache Tomcat mailing list, you know what you're about to be hit with.

For others, it's best to press "next" now :-p.

This is a thumbnail sketch on how to get going.

First of all, in your original mail message you didn't say what type of 
web application you wanted to build. Unlike Tomcat, Apache HTTPD doesn't 
really run applications by itself. It uses modules to enable creation of 
dynamic content. Some of these modules are:

mod_cgi - Generic CGI module
mod_perl - Perl module
mod_php - PHP module
mod_fcgid - Fast CGI module

There are a bunch of others (Python, Scheme, etc.), but the above are the 
major ones.

To get mod_cgi to work, you just follow the directions at:


which you said you've read, so I won't rehash the documentation.

Obviously, in order to get Perl scripts to run, you'll need to install 
Perl. ActiveState Perl makes a nice Windows version.

CGI is a rather slow way to execute scripts, since Apache HTTPD has to 
start up an interpreter for each request. A better way to do this is to 
run either a targeted module (mod_perl, mod_php), or mod_fcgid (fast cgi) 
which starts up several copies of an interpreter and keeps them running to 
manage requests.

mod_fcgid is available as a binary from Apache. I've not used it on 
Windows/XP, so read the documentation (which you've said you've done).

mod_perl may or may not be up to date, and the dependencies may or may not 
be available. The last time I attempted to install mod_perl on Apache 
2.2.x and Windows/XP, the dependencies were not available, and the 
installation failed. This may have changed.

mod_php is probably the easiest to implement. I'll outline the 
installation below, since you've already read all of the documentation.

1. Install Apache HTTPD 2.2.x
   a. Use a directory without spaces
   b. Make sure you can run this as a service before doing anything else
   c. Drop in some HTML and CSS, to make sure Apache HTTPD serves this up
   d. Don't forget to allow port 80 in the firewall if you want to 
      remotely access your web server
2. Install PHP
   a. Use a directory without spaces
   b. Install PEAR
   c. Install PECL extensions if needed
   d. Edit php.ini
      1. enable extensions
      2. set time zone
      3. set latitude and longitude
      4. php.ini has copious comments
3. Edit httpd.conf to include PHP
   a. add module - for example:
      LoadModule php5_module "C:/PHP/php5apache2_2.dll"
   b. Tell Apache HTTPD what constitutes PHP files - for example:
      AddHandler application/x-httpd-php .php
      AddHandler application/x-httpd-source .phps
   c. Tell PHP where it can find the php.ini file - for example:
      PHPIniDir "C:/PHP"
4. Restart Apache HTTPD

Now to test, create the following simple PHP file and call it info.php.

<?php print phpinfo(); ?>

Browse to http://localhost/info.php and see what it says.

Lather, rinse, repeat.

Now you should be able to write and run PHP applications. I like using 
NetBeans as an IDE - your tastes may differ.

If you've noticed, I've been a bit sarcastic from time to time when 
answering your question. For that I apologize. However, there are good 
reasons for why you've not received a reasonable answer to your question.

1. You didn't clearly state what you wanted to accomplish
2. You stated that you've read "all" of the documentation

If you had said something like:

"I want to run dynamically generated content from an Apache HTTPD server. 
I am familiar with Tomcat, servlets, and JSP. I would like to do similar 
things using Apache HTTPD. What languages and setup are recommended?" 

Someone would probably have pointed you to PHP and one of many blog posts 
on getting PHP and Apache HTTPD running on Windows/XP. In addition, you 
could have started a mini flame war if people started suggesting MVC 
frameworks - eh, but that's programming in general.

All of the answers that I've outlined above are readily available from 
existing documentation as well as by searching the HTTPD mailing list 
archives. Stating you have read "all" of the documentation while asking 
such poorly a defined question indicates a lot of things, none of which 
are good.

Hopefully, this will get you started.

Also, read the following:

We're all just volunteers, trying to give a little back to the community. 
Make it easier to volunteer.

. . . . just my two cents

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message