HOME: INFORMATION MANAGEMENT TOOLS : INSTALLING APACHE SERVER, MySQL DATABASE, & PHP SCRIPTING LANGUAGE


 

Introduction
This tutorial explains how to set up Windows 2000 to run Apache Web Server, MySQL Database and PHP Scripting Language.
  Download QuickSetup.zip before you start.
download
download
QuickSetup.zip
Download
I.  Download the latest stable version of Apache:
http://apache.roweboat.net/httpd/binaries/win32/apache_1.3.29-win32-x86-no_src.zip

Note:  It can be confusing to know which version of Apache (or Mysql or PHP) to download; typically, there are many options available.  We have provided a direct link above to the final, and most stable, version of the Apache 1.3.x series.  For purposes of running MySQL and PHP, it is recommended that users do NOT download the Apache 2.x series.


II.  Download the latest stable version of MySQL:
http://www.mysql.com/get/Downloads/MySQL-4.0/mysql-4.0.18-win.zip/from/pick

As with the Apache software in above, we have provided a direct link to the appropriate MySQL downloads.  If this link does not work, please advise, and Coweeta LTER will assist.

III.  Download the latest stable version of PHP: http://www.php.net/downloads.php
Coweeta LTER currently uses PHP version 4.3.1.; as of the writing of this paper, version 4.3.5 is the latest stable version.  You will see various download options...choose the one that is under heading "Latest Stable Version" > "Windows Binaries".  There will be two options under Windows Binaries, download and save the package that includes mention of "Apache".




Step 1:  Install Apache Web Server
Install Apache by clicking the setup file.
You will be asked to fill in the server name, domain name and admin email address. These fields are used for server error messages etc.
To start the server, you simply go:
Start > Programs > Apache httpd Server > Control Apache Server > Start
To stop the server you simply go:
Start > Programs > Apache httpd Server > Control Apache Server > Stop
Close (Stop the Server) down for now.


Step 2:  Install MySQL Database
Install MySQL by clicking the setup file.
Once installed, Go to
C:\mysql\bin\mysqladmin.zip.
This is used to start / stop the MySQL server. I suggest you put a shortcut to this file on your desktop.
The first time you run this file, you will be prompted for a username and password. Remember these because you will need them when coding in PHP.
When the server is running, you will see a traffic lights icon in your system tray showing green lights when the server is running and red lights when it is not.
You will also find that the standard install puts MySQL in your startup, so it automatically starts at boot. To remove this go:
Start > Programs > StartUp, find it and delete it.


Step 3:  PHP Installation and Configuration

Create the folder
C:\php
Unzip your PHP files to
C:\php\
Copy
C:\php\php4ts.dll to C:\WINNT\System32\
Copy all DLL files from
C:\php\dlls\ to C:\WINNT\System32\
You now need to configure your php.ini file. A configured version is included in our QuickSetup.zip
Copy it to
C:\php\
. You can now skip the next section.

 
Skip if you used the above php.ini file
If you want to edit your own php.ini file, open C:\php\php.ini-dist in Notepad.
Find the line that says
extension_dir =
Make this line read
extension_dir = C:\php\extensions;
Find the line that says
;extension=php_gd.dll

Remove the semi-colon from the beginning of this line. By removing the semi-colons from this section,
you are telling PHP which extensions to load, in this case, GD is a graphic handling extension
which can be used to create images.
Tip: When using Notepad, it likes to put .txt extension on saved files. To stop this remember to
select All Files from Save as type drop down in the save dialog, then save your file with the extension
on the end, eg: phpinfo.php



Step 4:  Configure your Registry

You now need to configure your registry. A RegScript.reg is included in our QuickSetup.zip
Execute this script.
Make sure you have printed this document and re-boot your system. You can now skip the next section.

 

Skip if you used the above RegScript.reg file
If you want to write your own RegScript.reg open Notepad and type:

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
".php"="C:\\php\\sapi\\php4isapi.dll"


Save this file as RegScript.reg and execute it.
Make sure you have printed this document and re-boot your system.



Step 5:  Check the registry
Go: Start > Run and type: regedit.
Go:
HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > w3svc > parameters > Script Map
Check that
.php is in the right hand pane and that the data value is C:\php\sapi\phpisapi.dll
If it isn't, in the right hand window, right click the mouse and choose
New | String Value, give it the name ".php" and press enter.
Double click on this key and enter the path:
C:\\php\\sapi\\php4isapi.dll in the Value Data field and press OK.
Make sure you have printed this document and re-boot your system.


Step 6:  Apache Configuration
You now need to configure Apache to deal with PHP files. A httpd.conf file is included in our QuickSetup.zip
Copy this file to:
C:\Program Files\Apache Group\Apache\conf\
and overwrite the existing httpd.conf file.
You can now skip the next section.

 

Skip if you used the above httpd.conf file
If you want to edit your own httpd.conf, Go: Start > Programs > Apache HTTP Server > Configure Apache Server > Edit the Apache httpd.conf Configuration File
Go to the line:
AddType application/x-tar .tgz. Below that line add the following:

ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phpl
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php/php.zip"


Search for DocumentRoot and change to:
DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/"

Search for Directory and change it to look like this:
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/Program Files/Apache Group/Apache/htdocs/">



Step 7:  Testing your installation
You now need to use a phpinfo.php script to check your installation.
A phpinfo.php file is included in our QuickSetup.zip
Copy this file to:
C:\Program Files\Apache Group\Apache\htdocs\
You can now skip the next section.

Skip if you used the above phpinfo.php file
If you want to create your own phpinfo.php file, open Notepad and type:
<?php
phpinfo();
?>

Save this as
C:\Program Files\Apache Group\Apache\htdocs\phpinfo.php



 

imgStep 8:  Start Apache: Start > Programs > Apache httpd Server > Control Apache Server > Start
Open your browser and type this URL:
http://localhost/phpinfo.php

If all was successful, you should be seeing a PHP page with lots of information about your installation. PHP4 is enabled on your server and you are a happy bunny.

If you are not seeing a PHP page, don't panic. Go back and double check that you followed the instructions correctly. It's probably something simple.

Setting up this environment up can seem a bit tricky the first time around, but it is worth the effort, and future installations will become much easier.

nsf - national science foundation

This material is based upon work supported by the National Science Foundation
und
er Cooperative Agreements
DEB-9632854 (Text Version) & DEB-0218001 (Text Version).

Any opinions, findings, conclusions, or recommendations expressed in the material are those of the authors and do not necessarily reflect the views of the National Science Foundation.

Copyright © Coweeta LTER. All rights reserved.