Installation Instructions for setting up Apache
with PHP4 and OpenSSL using DSO.

Contact: sales@atlasindia.com

Back

 

[Note that this installation does not include the optional RSAref library.
This is optional for users not in the US. IF you need to install this, take a look at
the INSTALL file inside the ModSSL distribution]


1. Apache v. 1.3.x with Dynamic Shared Object (DSO) Support.
2. PHP 4.0
3. Open SSL
4. Mod SSL


Pre-requisites:

Perl Version 5.04 or better.
gzip or gunzip
gcc and GNU make


Step 1: Get the source for everything together.

From http://Apache.org download: apache_1.3.12.tar.gz
From http://php.net download: php-4.0.0.tar.gz
From http://OpenSSL.org download: openssl-0.9.5a.tar.gz
From http://ModSSL.org download: mod_ssl-2.6.5-1.3.12.tar

Put everything into one directory.

Un-zip and un-tar everything.

Example:

$ gunzip apache_1.3.12.tar.gz
$ tar -xvf apache_1.3.12.tar

or all on one line:

$ gzip -d -c apache_1.3.12.tar.gz | tar xvf -

Do the same for all the four downloaded archives.

You'll end up with 4 directories.

apache_1.3.12
mod_perl-1.24
openssl-0.9.5a
php-4.0.0



Step 2: Configure and make OpenSSL.

Change directory to the place where you unpacked the Open SSL package.

$ ./config --prefix=/usr/local/ssl2

You should get a message like this on completion: "Configured for linux-elf."

The --prefix option specifies the final installation location.

$ make

(Lots of junk is gonna fly by the screen and may take some time)

$ make test


(Lots of things fly by again)

cd ..

Step 3:

a)Apply the mod_ssl source extension and source patches to the Apache
source tree.

b) Configure the Apache sources and build Apache with mod_ssl and OpenSSL.

Note: You configure Apache semi-automatically from within mod_ssl's `configure' script.

Now change directory to the ModSSL directory where you unpacked the ModSSL package.

Note: Do all of this on one line. Make sure to type in the paths to the source distributions correctly.

$ ./configure --with-apache=../apache_1.3.x --with-ssl=../openssl-0.9.x
--prefix=/path/to/apache --enable-module=so --enable-shared=ssl


Apache has lots of other options too which provide different functionality to the webserver.
Which you may want to utilize. All it takes is to add another little "--enable" instruction
to use the module. Take a look at the INSTALL file in the Apache Source Distribution for pointers.


$ cd ..


Step 4. Build Apache


Change directory to the Apache source directory.

$ make

(Lots of junk !)

$ make certificate

You'll be asked some questions.
Choose RSA, answer a few questions and you'll be asked to set a password for the certificate.

$ make install

(Lots of junk !)

You should see this at the end.

+--------------------------------------------------------+
| You now have successfully built and installed the |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the |
| (initially created or preserved) configuration files |
| |
| /usr/local/apache/conf/httpd.conf
| |
| and then you should be able to immediately fire up |
| Apache the first time by running: |
| |
| /usr/local/apache/bin/apachectl start
| |
| Or when you want to run it with SSL enabled use: |
| |
| /usr/local/apache/bin/apachectl startssl
| |
| Thanks for using Apache. The Apache Group |
| http://www.apache.org/ |
+--------------------------------------------------------+

Step 5: Fire up Apache and check whether it works !

$ cd /usr/local/apache/bin

./apachectl startssl

Enter the password you selected in the last Step.

Open up a browser and check your system URL. You should see the Apache Greeting.
Try the same URL with an https://www.yourname.com - you should get a certificate challenge.


Step 6: Well that's done. Now let's get PHP configured, made and installed.

We'll do the DSO quick install.

All that's required is that you have the following installed:

mod_so.c

It will be there already. But check by using httpd -l. You'll see a lot of modules.
The httpd executable is inside the apache installation directory inside the subdirectory 'bin'.

Change directory to the place where you unpacked the PHP source.

$ ./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs


Note:

You can use additional options for PHP too. Mysql is used here in the example only
because it's the most commonly used Database with PHP.


Example:

--enable-track-vars

(Although the PHP installation instructions does not need you to give the absolute path to 'apxs' it often
returns an error if you do not give the absolute path. 'apxs' is found in the 'bin' subdirectory inside
the Apache installation location.)

You should get this message on completion.

+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

$ make

$ make install

(You'll get one warning about DAPI - ignore it. Or tell me how to get rid of it.)

Now go to your apache installation directory and edit you httpd.conf file.
It can be found insie the subdirectory 'conf'.

Uncomment the following line, and add the extensions that you want the server to recognize as that which
should be handled by PHP.

AddType application/x-httpd-php .php .php3 .phtml

If you want color syntax highlighted for PHP source code uncomment the line:

AddType application/x-httpd-php-source .phps



To Test PHP:

stop Apache first if it's already running.

$ ./apachectl stop

Now restart

$ ./apachectl startssl

create a file inside the 'htdocs' directory which is also inside the Apache installation directory called test.phtml.

put in the following PHP code.

<? phpinfo() ?>

Now point your browser at your domain name and call the script. http://www.yourname.com/test.phtml

You should see the PHP Logo along with the Zend logo and a whole lot of system environment information.