Originally Published: Friday, 13 April 2001 Author: Dallas Engelken
Published to: develop_articles_tutorials/Development Tutorials Page: 1/1 - [Std View]

Installing Apache 1.3.19 with mySQL + PHP4 + FrontPage 2000

Follow Dallas Engelken as he takes you step-by-step through the installation process of everybody's favorite Web server configuration.

I. Introduction:

This article will take you through, step by step, an Apache 1.3.19 install with support for mySQL, PHP4, FrontPage 2000, and virtual hosting with all these features. It has been tested on stock Redhat 7.0, and Mandrake 7.2, so it should work on any flavor of Linux you want. Would also work on any other form of *NIX but you will have to download different packages for the install.

II. Requirements:

1. An Intel base Linux install with TCP/IP support and libc6. If apache or mySQL has already been installed out of the box, then I would recommended removing them either with a package manager or by hand.

2. The packages required to do the install, this includes : Apache 1.3.19, MySQL Server, PHP4, and FrontPage 2000 Extensions. The patch binary to patch apache with FrontPage support. A recent gcc compiler and libs associated with it.

III. Preparing For Install

A. Downloading Packages

Download the following packages to /downloads

B. Un-packing the source

Extract all packages in /download execpt for frontpage which will need to extract to /usr/local

tar zxfv apache_1.3.19.tar.gz
tar zxfv fp40.linux.tar.gz -C /usr/local
tar mysql-3.23.32.tar.gz
tar zxfv php-4.0.4pl1.tar.gz

IV. Installing mySQL

Installing mySQL is the first step in our journey. This has to be done Before anything else, because you are installing PHP with mySQL support, and then Installing Apache with PHP support. You can see the chain of events to come.

A. Setting up users and Groups

First, lets add user mysql and group mysql to your box.

groupadd mysql
useradd -g mysql mysql

B. Configuring and Making mySQL

Now lets change to the /downloads/mysql-3.23.32 directory and run a configure and make on mySQL. If you would like to store your databases somewhere other than /usr/local/mysql/var/, then add --localstatedir=/my/new/path to your ./configure

cd mysql-3.23.32
./configure --prefix=/usr/local/mysql
make install

mySQL has now been installed into /usr/local/mysql There is currently not a data director (i.e. ../var). Now lets run the script that comes with mySQL to create var and install the test databases.


Before we start the daemon, changes to the ownership of the files is a must, or else the daemon will fail to run.

chown -R mysql.mysql /usr/local/mysql

C. Starting the mySQL Daemon

Okay, now we are ready to start the daemon. Safe_mysqld is the equivilent of a tcpwrapper for mysqld. Tcpwrappers are commonly used to wrap services in inetd for added secrutiy.

/usr/local/mysql/bin/safe_mysqld --user=mysql &

D. Setting root password and starting mySQL on boot. Now mysql is up and running, might want to set a root password on mysqladmin

/usr/local/mysql/bin/mysqladmin -u root -p password 'yourpass'

One last step is needed to insure that mySQL will start up on reboot. Edit your /etc/rc.d/rc.local and place /usr/local/mysql/bin/safe_mysqld --user=mysql & at the bottom of the file. Or you can always write a start/stop script for it that can be symlinked in your runlevels.

V. Patching Apache

Before proceeding, we must apply the FrontPage patch to Apache. Copy the FrontPage patch over to the Apache source directory and make a symlink to currentversion of FrontPage. Lets create a symlink for currentversion also.

cd /usr/local/frontpage/
ln -s version4.0 currentversion
cd currentversion/apache-fp
cp fp-patch-apache_1.3.12 /downloads/apache_1.3.19

A. Applying FrontPage Patch

Now apply the FrontPage patch to the apache source directory. This will require the patch binary to be in place in your path. Download the patch rpm and install it if needed.

patch -p0 < fp-patch-apache_1.3.12

This will create mod_frontpage.c in the apache source root. It needs to be copied over to extras modules.

cp fp-patch-apache_1.3.12 src/modules/extra/

B. Running a simple apache configure

Now run a simple configure, we will run a more advanced one in a bit.


VI. Installing PHP4

PHP is a server-side, cross-platform, HTML embedded scripting language. It gives us the ability to develop dynamic sites that interface easily with the mySQL server that we installed above.

A. Configuring PHP4 with mySQL and Apache Support

You will be installing PHP4 with mySQL in /usr/local/mysql .

cd /downloads/php-4.0.4pl1
./configure --with-mysql=/usr/local/mysql --with-apache=/downloads/apache_1.3.19 --enable-track-vars

B. Configuring PHP4 with mySQL and Apache Support

Now make and make install and it will compile the files necessary for the Apache below.

make install

VII. Installing Apache Server

Apache Server is what everything in this whitepaper revolves around. This is the most important part, so follow closely . Now that PHP has been made, you will find a new directory in your Apache source, ../apache_1.3.19/src/modules/php4 We will now ./configure apache yet again, but this time with PHP support and FrontPage support built in statically.

A. Creating Symlinks and Directory Structure

I also like to set up a symbolic link from /usr/local/httpd to /usr/local/apache-1.3.x so you can just make a new version of Apache and then redo the symlink when necessary. To do so, type

mkdir /usr/local/apache-1.3.19
ln -s /usr/local/apache-1.3.19 /usr/local/httpd

B. Configuring Apache with FrontPage and PHP4 Support

Now we can configure apache with the --prefix=/usr/local/httpd and it will symlink to apache-1.3.19 for us. Yes I know, src/modules/php4/libphp4.a does not exist, but it will: That's what the Makefile is there for. You will also notice you --addmodule on FrontPage, and --activeate-module on PHP. Just be aware of the that. Now make and make install Apache. The other thing that may or may not be important to you is where your httpd.conf file is located. Some people like it in /etc. If you are one of those people, just add --localstatedir=/etc to your Apache ./configure command.

cd /downloads/apache_1.3.19
./configure --prefix=/usr/local/httpd

C. Making Apache

Running make will create the httpd binary. If you are overwriting and old server, then make is all you need to do, and then copy the httpd binary from the bin dir to overwrite your existing httpd production binary. I however, recommend a fresh install, because it is very easy to migrate www data and conf files over from a previous install.

make install

VIII. httpd.conf changes

Great, you have installed Apache 1.3.19 with FrontPage, PHP, and mySQL support. Now lets wrap some other things up so this all works together. First some httpd.conf configuration changes.

A. Adding PHP tags

In order for Apache to handle PHP extensions, it must have the type added to it. Make sure you have the following 2 lines uncommented in your configuration file. If those two lines do not exist in your stock httpd.conf then add them manually.

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

B. Changing Directory Index

I also change the DirectoryIndex support to add index.php and index.shtml. This is totally by preference, but if your site is strictly written using SSI or PHP, then having these extra DirectoryIndex files will keep you from having to reference the full path to the index file. Instead you can simply type http://www.virtual.com/ instead of http://www.virtual.com/index.php which you would have to type if you did not include these two.

DirectoryIndex index.php index.shtml index.html index.htm

B. Changing Directory Permissions

A couple other important changes that need to be made to the configuration file are in the DocumentRoot and Directory accesses. Change the DocumentRoot to where your default page will be, I set this to

DocumentRoot /www/httpd

Now change direcoty permissions on this so that FrontPage can override them with their .htaccess files. AllowOverride is changed from None to All

<Directory "/www/httpd">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all

If you are doing virtual webs, follow the same format in adding them. I'll go into this further as I get into it further.

IX. Applying Frontpage Extensions to the Root Web

We have now successfully installed Apache with PHP and mySQL support. All that's left is FrontPage extensions, which you may or may not want on your site. It is nice to have when you have multiple people needing to edit a site and not everyone is familiar with FTP and HTML.

A. Running fpsrvadm.exe

Lets apply the FrontPage extensions to our root web. (/www/httpd).

cd /usr/local/frontpage/currentversion/bin/

And run fpsrvadm.exe to install extensions into the root web.

./fpsrvadm.exe -o install

: 0 for apache (do not choose apache-fp)
: /usr/local/httpd/conf/httpd.conf (patch to server config file)
: ENTER (Just hit enter for a blank multi-hosting)
: apache (user owner of DocumentRoot (i.e. /www/httpd))
: web (group owner of DocumentRoot (i.e. /www/httpd))
: myuser (frontpage login)
: mypass (frontpage password)

Note: I use user: "apache", group: "web" myself for the owner of Document Root. For virtual domains, I have separate users for each virtual domain, but the group is always "web".

B. Creating other FrontPage Users

Now simply provide an account for the administrator to FrontPage and a password for that account. This will be the login and password you use to access via FrontPage. I is probably better if you keep these in-sync with the ftp login. You can always come back and run ./fpsrvadm.exe and add a user to it using Option 7 and entering the correct info. Or you can modify /_vti_pvt/service.pwd which contains the users, with their encrypted passwords, who can log into FrontPage. If you need to make the encrypted password, use the

htpasswd temp.pass.file
Enter Password : **********
pico temp.pass.file

And then just copy the user and encrypted password to service.pwd file and that user can log in. You will also have to group that user so modifications to the site can be made. This is done by editing /_vti_pvt/service.grp

pico _vti_pvt/service.grp
administrators : administrator <my-new-user>
authors :

Add your new user to whatever group you see fit to modify the site. Now try the login and password through FrontPage and the user should have editing rights after the addition to the "authors" or "administrators" group.

X. Creating Virtual Webs with FrontPage Support

Adding FrontPage support to virtual webs is the same process covered in adding them to the Root Web. The only difference is you provide a multi-hosting name when running fpsrvadm.exe instead of just hiting enter. The multi-hosting name that you enter will be the ServerName defined in the <VirtualHost>

Lets walk through this and give a couple options. First, edit your httpd.conf and uncomment the NameVirtualHost line. If you only have 1 IP address on this box, then the first virtual host in the list will be your root web. If you have 2 IP addresses for the box, then your root web might be on and your virtual webs could be on This would keep your root web intact.

if you have 1 ip address
NameVirtualHost *
if you have a separate ip address just for your virtual webs

Make sure that if you have multiple IP addresses, you tell Apache what IPs to listen on, or use Listen * to make Apache listen on all interfaces that are listed in an "ifconfig".

# to make apache listen on all ip addresses assigned to the box
Listen *

# Listen for root web

# Listen for virtual webs

Now that you know that information, lets add a virtual web.

<VirtualHost *>
ServerAdmin root@virtual.com
ServerName virtual.com
DocumentRoot /www/virtual.com/public_html
CustomLog logs/virtual.com/access_log combined
ScriptAlias /cgi-bin /www/virtual.com/public_html/cgi-bin/

<DIRECTORY /www/virtual.com>
AllowOverride All
Options Indexes FollowSymLinks Includes ExecCGI MultiViews
Options All
order allow,deny
allow from all

<DIRECTORY /www/virtual.com/public_html/cgi-bin>
AllowOverride None
Options ExecCGI FollowSymLinks INcludes

LogFormat Combined
ServerAlias virtual.com *.virtual.com

First, a few points on this virtual domain definition. <VirtualHost*> can be changed to any of the following.

# To make this virtual web listen on all interfaces and all ports
<VirtualHost *>

# If you have a separate IP # for virtual hosting <VirtualHost>

# To listen only on port 80 on

# To listen only on port 80 on all interfaces
<VirtualHost *:80>

I just use <VirtualHost *> because I only have 1 IP address allotted to my box. Be aware, this does destroy your root web (/www/httpd) and makes your first <VirtualHost> definition your root web.

In the instance that someone goes to the IP # of your box, they will be served the first virtual web, instead of the root web. That's why it is nice sometime to have 2 IP addresses on the box, and assign the root web its own independent IP address. Or if you have a whole class C, or a subnet, then you can assign each virtual web its own IP address, which is even nicer.

The <Directory> definitions in the virtual host allow FrontPage to override the permissions using the .htaccess files.

Okay, now that you have a virtual host added to your httpd.conf named virtual.com", save your httpd.conf and lets apply a FrontPage extension to it.

cd /usr/local/frontpage/currentversion/bin
./fpsrvadm.exe -o install

: 0 for apache (do not choose apache-fp)
: /usr/local/httpd/conf/httpd.conf (patch to server config file.
: www.virtual.com (the name of ServerName in <VirtualHost>)
: apache (user owner of DocumentRoot (i.e. /www/httpd))
: web (group owner of DocumentRoot (i.e. /www/httpd))
: myuser (frontpage login)
: mypass (frontpage password)

Note : For virtual webs, create a user on the box for each virtual web.

My user and group in this situation would be.

: virtual ( user for virtual.com)
: web ( i use same group for all websites)

user and group must be valid in /etc/passwd and /etc/group prior to running ./fpsrvadm.exe to install the FrontPage extensions. Now FrontPage Extensions have been copied over to the DocumentRoot of your new virtual web (i.e. /www/virtual.com/public_html).

You can change to that directory and verify you have the _vti_ folders in place.

Now try to connect to your new virtual web through FrontPage. Open Web - http://www.virtual.com

It should ask you for the login and password that you specified in the ./fpsrvadm.exe setup of virtual.com If this works, then you are ready to add more Virtual domains to httpd.conf and then apply the FrontPage extensions using ./fpsrvadm.exe in the same manner!

XII: Testing Files

The only other step is to test your PHP, CGI, and SSI. You can use the following files or create your own. Upload the files to your webserver via FTP and then point your browser to them to test.

A. PHP Test File File : test.php
<title>PHP Test</title>
<?php echo "Hello World<P>"; ?>

B. CGI Test File

File : test.cgi (make sure to chmod 755 at least.)

print "Content-type: text/html\n\n";
print "
<title>Perl Test</title>
HEllo World

exit (0);

B. SSI Test Files File : test.shtml
<title>SSI Test</title>
<!--#include virtual="test.txt">
File : test.txt (used in SSI parsing in test.shtml file above)
Hello World

XIII. Conclusion

If you have made it this far, you have successfully installed everything. You have also tested the server to make sure what we have done is functional. The only thing I have really left out of this article is mySQL testing. Database integration using PHP will be written on once I have done my own experimentation.

Good Day and Good Luck,

Disclaimer :

The author of this article takes no responsibility for you the reader, and provides this for informational purposes only. All testing should be done on a non-production server before implementation.

Dallas Engelken is an Internet Business Consultant for Network Management Group, Inc. in Hutchinson, Kansas. He can be contacted via email at dallase@nmgi.com or by phone at (620)664-6000.