This is documentation for installing Apache 1.3.9, PHP 3.011, Perl 5.00502
and MySQL 3.21.29, but should work with ANY recent (or more recent) versions
of this software. Note if you have ActiveState for Perl installed, either uninstall
it, or skip the installation section below for Perl, simply make sure the the
shebang line (the first line of your Perl script) points to the path of the
ActiveState file "perl.exe". See more in Step Two
The ability to develop locally on my laptop has been a fantastic time saver.
Saving, uploading and testing to a remote server is an arduous task. It's easier
to develop locally and then upload once everything is tested.
Configuring for Windows is easy, but the documentation for installation from
the software companies is hideous.
Here's the Easy Way: (pay very close attention to slashes and back slashes below)
Step One - Grab the Needed Files:
Go to the MySQL mirror page
and find an FTP mirror (this is easier than trying to download from the site
itself, and gives you a look at all the needed files, and others you may find
of use once you get up and running.
On the FTP site - download these two programs (you'll have to navigate around
to find them - try under "packages" or "downloads". The needed files are in
the "Win32" folder)
Find the closest Apache mirror.
The mirror I found wasn't much of a mirror, and either didn't have or had hidden the latest Win version of Apache. I found it
You going to need a file called BROWSCAP.INI - grab it here:
Lastly - go grab the latest PHP for Windows
files from here. Make sure you download the binary file (with .zip extender).
Step Two - Installation of the software:
Unzip PHP into "C:/php3"
Unzip mysql anywhere. Run the setup.exe program from inside this folder.
This will automatically install MySQL into the "C:\mysql" folder
Unzip browscap.zip (which contains the browscap.ini file) and place browscap.ini
into "C:\windows" directory
Apache is a self-executable installation file - double click and it will install
itself - accepting the default installation directory of "C:\program
files\Apache Group\Apache" is fine.
Unzip the Perl archive. Anywhere is fine, but for these
examples I'll assume we extracted to the "C:\perl" directory. There
are two versions of Perl for Windows on this distrobution. Either will be
fine for local development work. It's important to know where Perl resides
on your local drive. The first line of any perl script (also known as
the "shebang" line and typically looks like "!# /usr/bin/perl"
(or something in similar) will actually point to the physical location of
Perl on your local drive. If you extracted to the "C:\perl" directory
per above, then your shebang line will read "!#/Perl\bin\MSWin32-x86\Perl"
- the shebang line points to the actual file "perl.exe" - without
the ".exe". If you are using the ActiveState version of perl - this
line should point to the location of the ActiveState "perl.exe".
Step Three - Configuration of the software:
Load the file "C:\program files\Apache Group\Apache\conf\httpd.conf"
into a text editor. This is the Apache configuration file. Search for "#ServerName
new.host.name" in the the file (it should be on or around line 232 but the
line number may change in future releases) and change this to read: ServerName http://localhost (note: Be sure to take out the "#" - this is known as a comment mark
which basically means 'ignore everything on
Around line 458, add this: ScriptAlias /php3/ "c:/php3/"
Around line 506, add this: AddType application/x-httpd-php3 .php3
Around line 643, add this: Action application/x-httpd-php3 "/php3/php.exe"
Around line 239, change DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"
to point to wherever you'd like your pages served from. I suggest making
a directory structure that resembles your remote server set up - usually
this means creating a directory in the local C drive like "C:\usr\bin\html\"
or something along those lines. All the development work (i.e. - web pages,
PHP or Perl scripts) you want Apache to serve must be saved locally under
in the directory that follows "DocumentRoot" on this line.
Around line 264 - change the line to point to the same directory
tree specified in No. 5 above.
Create a cgi-bin directory for your perl scripts. I recommend this be
"/cgi-bin" ABOVE the DocumentRoot path from step 5 above.
Around line 458 (right where we added the PHP config line in step 2 above),
add this line: ScriptAlias /cgi-bin/ "c:/POINT TO DO PATH TO CGI BIN CREATED IN STEP
At or around line 465 should currently point to "C:/Program Files/Apache
Group/Apache/cgi-bin". Change the path to point to the same directory in number 8 above.
In a new text editor, create a php test file - something along the lines
of <? print "welcome home"; ?> and save this as "index.html"
in whatever path you specified in number 5 and 6 above.
Familiarizing yourself with all of the httpd.conf file will help in configuring
the server and will give a great overall understanding of how Apache works.
Find the file php3-ini-dist in the "C:/php3" directory
Rename it to php3.ini
Load it in a text editor
Search for "extension_dir" (around line 100) in php3.ini and change
line to read: extension_dir = C:\php3
Change the line (around 115) that reads ;extension=php3_mysql.dll to read
Change the line that reads (around 225) ;browscap = extra/browscap.ini
to browscap = C:\windows\browscap.ini
Place this file (php3.ini) in "C:\windows\"
Note above the removal of the ";" line - this is the comment
tag for PHP, and must be removed in the above lines.
Step Four - Test The Software
Reboot your machine.
Go to the DOS prompt (There should be a shortcut on the Windows start
menu. Stay calm when the screen goes black after clicking - it's supposed to
Test Apache and PHP: Go to your browser and type this "http://localhost"
If it worked you'll see the output of the PHP script saved as the home
(index.html) page above.
Any error messages are probably a function of a simple
error in the php.ini or the httpd.conf file. Check your paths - and check
to make sure you have the back slahes and forward slashes exactly as
they are written in the text of this documentation.
Test MySQL Open another dos window, go to the "C:/mysql/bin"
directory, and type mysqld
mysqlshow -u root mysql
mysqladmin version status proc
You should now be logged into the MySQL server.
Test Perl: Create a test script in your text editor - something like this
print "content-type: text/html\n\n";
Save this file in the /cgi-bin/ specified under "Configure Apache"
Point the browser to the new script you just created. Success will yield "hello"
- any 500 errors will be problems with the shebang line of the script. Make
sure this is correct if you are having problems with perl.
Important things to remember:
You must run apache first, then MySQL, and any changes made to the apache
config files in httpd.conf will only take place once your shutdown and
restart the server.
To shut down the server, type "Control-C" from the window
To run perl scripts from the command line in a DOS window, simply go
to the Windows Explorer menu, associate ".pl" and any other
extender to the perl.exe program installed above, then type "perl
script-to-run.pl" from the DOS prompt.