Friday 04 August 2006 1:41:00 pm
Apache is the web server application that handles incoming requests for content. Depending on the kind of request, it will either serve content itself or pass the request to PHP. For example, if you request an image it might be served directly from Apache, while PHP scripts are executed by the PHP module. In the case of eZ publish there is a combination of these request types.
The Apache web server is free software and can be downloaded from http://httpd.apache.org/download.cgi
There are two main versions of Apache currently in use: 1.3 and 2. Apache 1.3 is recommended, as PHP running on that version is the most stable and mature.
A non-threaded web server is recommended, because there could be problems related to PHP extensions and the libraries it links to with scripts that run in a threaded environment. The reason for this is that not all libraries that PHP uses are thread safe and under heavy traffic problems might occur.
If you cannot use Apache 1.3, make sure to use the "prefork" version of Apache 2, not the "worker" version. The "worker" version is a Multi-Processing Module implementing a hybrid multi-threaded multi-process web server. By using threads to serve requests, it is able to serve a large number of requests using less system resources than a process-based server. For more information about Apache 2 with a threaded MPM, refer to
http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2.
Some of the major differences between the 1.3 and 2.0 versions of Apache are:
If your Linux distribution does not include Apache, or does not include the version you need, you can compile Apache from source. Before you start, make sure that you have access to the root account.
The basic commands you must execute to compile and install Apache 1.3 from source are:
shell> cd /usr/local/src shell> gunzip < /PATH/TO/apache_xxx.tar.gz | tar xvf - shell> cd apache_xxx shell> ./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite shell> make shell> su - shell> make install shell> /usr/local/apache/bin/apachectl start
These commands perform the actions described below
1. Choose the directory under which you want to unpack the distribution, and then change location into it. In the following example, we unpack the distribution under /usr/local/src.
shell> cd /usr/local/src
2. Obtain an Apache distribution from http://httpd.apache.org/download.cgi.
3. Unpack the source file, which creates the installation directory. This example shows how to unpack the distribution using gunzip:
shell> gunzip < /PATH/TO/apache_xxx.tar.gz | tar xvf -
The tar command creates a directory called "apache_xxx" (where "xxx" is the Apache version number). If you are using GNU tar, no separate invocation of gunzip is necessary. Instead, you can use the following command to uncompress and extract the distribution:
shell> tar zxvf /PATH/TO/apache_xxx.tar.gz
3. Change location into the installation directory:
<span>shell> cd apache_xxx</span>
4. Run the configuration script with following parameters:
shell> ./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite
The first parameter specifies where to install Apache. The second parameter tells Apache to compile support for loadable module support. The last parameter tells Apache to compile the rewrite function as a module. To see additional configuration options, run:
shell> ./configure -help
The configure script will take several minutes to run, as it tests for the availability of packages and prerequisites on your system and builds the Makefiles which will later be used to compile the Apache application.
5. Now you can build the Apache application by running the make command:
shell > make
6. Switch to the root user before executing the following commands:
> su -
If you do not have access to the root account, ask your system administrator for help.
7. Next, install the package under the configured installation PREFIX (as specified in the --prefix option described above):
shell> make install
8. Start the Apache HTTP server by running:
shell> /usr/local/apache/bin/apachectl start
At this point you should be able to request your first document via the URL http://localhost/. The web page you see is located in the DocumentRoot, by default /usr/local/apache/htdocs.
Stop the server by running:
shell> /usr/local/apache/bin/apachectl stop
Apache configuration instructions are described in the "Configurating Apache and PHP" section below.