Previous Next Contents Glossary Index References Cover License
Chapter 2. Apache installation steps
CONTENTS:
1. Downloading an Apache package
1.1 Where to search
1.2 Downloading a binary package
2. Running the installation package
2.1 Filling in the requested informations
2.2 Choosing the setup mode
2.3 Changing to your preferred folder
2.4 Terminating
3. Reinstalling
4. Customizing
5. Readying Apache for PHP
This chapter describes how to download a binary Apache package from the Internet, then install and customize the product, especially for running the PHP module.

1. Downloading an Apache package

1.1 Where to search

Apache software and documentations are available for free download at the site httpd.Apache.org. From the site home page you will be guided through to the data you need.

An Apache package in available in either source or binary form.

You download the source form and compile it, if you wish to thouroughly understand the product, and possibly contribute to its development.

The average user would download a readily compiled binary package. This guide is intended for this category of users.

1.2 Downloading a binary package

You can download an Apache package from httpd.apache.org/download.cgi. If this has changed, you can easily navigate to the appropriate location, from the httpd.apache.org home page: just connect to the httpd.apache.org site and follow the guiding hints. The binary package comes in two versions:
-a package complete with an installer called MSI (Microsoft System Installer) -- this is a file with an .exe extension. Example: apache_2.0.50-win32-x86-no_ssl.exe
-a package without the accompanying installer, the latter being already in your Windows system (recent Windows systems such as XP all have this installer)-- this is a file with the .msi extension.
Example: apache_2.0.50-win32-x86-no_ssl.msi

You can put the downloaded package anywhere. For neatness sake, you can create a folder were you would put software related downloads. For example: C:\SoftwareDownloads

The .exe version is bigger by 3 Mo (the accompanying Microsoft System Installer size), but it is quicker to run.

2. Running the installation package

With the .exe version you run the package by opening its file:
-select the file by clicking on it; depending on the setting of your Windows system, this may have opened the file
-if the file was not opened, click on the "File" menu, and select "Open"; alternatively, you can open the file by a double click.

Running the package starts the Installation Wizard which will ask you simple questions and do the installation. This done, Apache is in working order. Most often, it is even running and ready to accept requests.

2.1 Filling in the requested information

After you have read and agreed on the terms of the license, the Installation Wizard will request the Network domain name, the Server name and the System Administrator e-mail address.

Network domain: Enter the actual or intended domain name of your server. Example: hatayservices.com -- if you are setting up Apache just for locally testing scripts running under Apache such as developped in PHP, PERL, JSP, etc. just any name will do.

Server name: Enter your server Internet name, which is a subdomain name of the Network domain. Example: server.hatayservices.com -- as for the Network domain name, if you are installing Apache just for the purpose of locally testing scripts, any name will do.

System Administrator e-mail address: enter the e-mail address where you wish notifications from Apache to be sent.

The informations you fill in will be reflected in the configuration file (httpd.conf) that the Wizard will generate for Apache

2.2 Choosing the setup mode

Two setup modes are proposed: "Typical" and "Custom". Although "Custom" is recommended for experienced users, select this mode even if you are not experienced. Just click on "Custom" to select this mode, and leave the rest alone, as the initial setting is to install all of the system. This is the safest. In my experience, with apache_2.0.50-win32-x86-no_ssl.exe, the system installed in "Typical" mode may not be able to load a critical PHP module (php5ts.dll) by want of a required module.

2.3 Changing to your preferred folder

With Windows, the proposed path where to set the Apache system is C:\Program Files\Apache Group Although this may be safe, the space in the directory names can cause trouble with modules running under Apache, such as PHP. It costs nothing to create beforehand a path like c:\SoftwareSystems\ApacheGroup, and change the destination folder to it:
- click on the "change" label
- navigate to the desired directory
- click on "OK"

With UNIX, there is no such problem. You can just accept the proposed path.

2.4 Terminating

From then on, the Installation Wizard will do the rest to install Apache. If a "Next" button appears, click on it. At the end, a "Finish" button appears.
Click on it. If there was no error, Apache will start at once.

3. Reinstalling

Windows only

In case of error, you can try a new installation run.
The easiest to do is:

-stop Apache
-uninstall Apache, using the Add/Delete function from the Configuration Panel
-delete the directories created by the installation run, that the uninstall process did not delete
-run the installation package again.

An error when reinstalling can result from the Apache Monitor being still on. In this case, just stop the Apache Monitor, for example, using the CTRL+ALT+DEL key combination (simultaneously press the three keys, then select the Apache Monitor and click the Cancel key), and do the installation procedure again:
- uninstall Apache from the Configuration Panel,
- delete remaining Apache related directories
- run the installation package

4. Customizing

As installed, the Apache system does most of the things you might want it to do.
In this state, scripts that you want to execute have to be set in the document root (htdocs) directory or one of its descendant. To allow executing scripts from a directory outside the directory root, add the alias directive. Example:
Alias /appl "C:/MyAppl/Scripts"
This allows scripts contained in the C:/MyAppl/Scripts directory or its descendants to be executed. The path name "C:/MyAppl/Scripts is then to be replaced by its alias "appl". To run the script PHPInfo.php contained in the directory "C:/MyAppl/Scripts/PHP", a remote user then enters the request:
http://hostname:port/appl/PHP/PHPInfo.php"
where:
- hostname is the name of the host where the Apache server is
- port is the number of the port where Apache monitors the line for requests

As the C:/MyAppl/Scripts directory is outside the document root directory, you can use the <Directory> directive to allow execution of the scripts contained in it:

<Directory C:/MyAppl/Scripts>
   Order Allow,Deny
   Allow from all
</Directory>
The directives contained within the <Directory> and </Directory> tags allow scripts from the C:/MyAppl/Scripts directory and its descendants to be requested by users from all origins.

5. Readying Apache for PHP

After PHP is installed, add the requisite Loadmodule and AddType directives to the Apache configuration file, to allow PHP operations.

The LoadModule directive indicates where the PHP module is to be loaded from. With PHP 5, this module is php5apache2.dll. If PHP is installed in c:/SoftwareSystems/PHP, the directive is:

LoadModule php5_module c:/SoftwareSystems/PHP/php5apache2.dll

The AddType directive defines the extension of the files that Apache will process as PHP scripts. Example:

AddType application/x-httpd-php .php

This directive will cause all files with the .php extension to be process as PHP scripts.

These additions to the configuration file can be made only after PHP is installed because upon starting, Apache will attempt to load the php5apache2.dll. If it is not there, the starting will fail.

Just after php5apache2.dll, Apache attempts to load the php5ts.dll module. The latter must be in a directory where Apache can find it. In PHP 5, it is readily in the same directory as php5apache2.dll where Apache will first look for it, so you do not have anything to do.

Remarks

You may want to install a 1.x version of Apache instead of version 2, and PHP 4 or PHP 3 instead of PHP 5. In this case, in the replace php5_module php and php5apache2.dll with phpx_module and phpxapache.dll, where:
- x is the PHP version number
- apache is used instead of apache2

With these version of PHP you have to check where phpxts.dll is, and move or copy it to the directory that contains phpxapache.dll.

The .php suffix defined in the AddType directive is the usual extension for PHP scripts, but it is not mandatory. You can use another suffix to hide PHP scripts from unwanted intruders. Also, more than one suffix can be defined. For example:

AddType application/x-httpd-php .php .pph .xxx
With this directive, the files myfile.pph and file.xxx will be processed as PHP scripts.


Previous Next Contents Glossary Index References Cover License