NOTE: The content of this page may be outdated. Links may not be valid and the steps detailed may no longer work. This page is saved for archival purposes only.
This is a simple guide to installing the Apache webserver on Windows 2000 or Windows XP. This information only applies to Windows 2000/XP operating systems and newer. I do not recommend using other Windows (9x,Me) series but it should still work although there are differences. Required skills are installing windows applications, some text editing and accessing various controls in the Windows MMC.
NOTE: You MUST perform significant extra steps to make sure you have secured your Apache/PHP/MySQL configuration to actually use on the Public Internet. Microsoft Windows is (significantly) INSECURE by default. Please be aware of this!
|
Apache is the most popular webserver on the internet. It is completely free and its source code is freely available so you are free to use it anyway you like. Although it works best with Unix/Linux platforms, it is easy to setup and use as a test environment on Windows. It is also a good solution for a intranet webserver on a private local area network.
To make Apache the most useful you should use some powerful scripting language. For this we use PHP. Perl is also an option, but PHP programming is significantly easier. Both are entirely free for personal use. Also we want a database to store data. For this we use MySQL. There are others such as Postgres that also free, however PHP and MySQL work very well together. Furthermore transferring data between MySQL servers is relatively easy.
Collect all files before installation for ease. Each component may release updates or newer version several times a year. It is important to stay up to date with these release since most changes are for stability and security updates. If you do not need to worry about security updates, then updating should not be a big concern.
Apache website: http://httpd.apache.org
For Windows compatible files go to: http://www.apache.org/dist/httpd/binaries/win32/
Important: Selecting the version
If you plan on using a hosting service online, than it is recommended you
use the version of Apache most similar to the hosting service. The newer 2.0
is better, however since many hosting services still use the 1.x (as mine
does), I prefer to use version 1.3.x.
Version 1.3: Current version: 1.3.29 Download the file: apache_1.3.29-win32-x86-no_src.exe Version 2.0: Current version: 2.0.48 Download the file: apache_2.0.48-win32-x86-no_ssl.exe
PHP is a powerful easy to learn open source free scripting language for the web. Further information can be found at: http://www.php.net.
All downloads available: http://www.php.net/downloads.php
Important: Selecting the version
Again, match your hosting service if you prefer. Otherwise I strongly recommend
selecting the newest NON-beta version.
Current version: 4.3.6 Download the files: * PHP 4.3.6 zip package [7,201Kb] - 15 April 2004
MySQL is a powerful open source database which is free for personal use. It is highly recommended for use with PHP. Further information can be found at: http://www.mysql.com.
Important: Selecting the version
Again, match your hosting service if you prefer. Otherwise I strongly recommend
selecting the newest NON-beta (or NON-alpha) version.
All downloads: http://www.mysql.com/downloads/index.html
Recommended Current version: 4.0.18
Available: http://www.mysql.com/downloads/mysql-4.0.html
Download the file under "Windows downloads": Windows 95/98/NT/2000/XP/2003 (x86) 4.0.18 23.1M filename: mysql-4.0.18-win.zip
The following is my recommended way to install these programs. The order does matter somewhat. Apache should be installed before PHP. MySQL can be installed at any time.
Run: apache_1.3.29-win32-x86-no_src.exe
Server Information:
Network Domain: anything you want, com or net or org will work
Server Name: whatever you call your computer on your network, or any
name NO spaces, use letters and numbers only
Administrator's Email: leave blank -or- set your working email address
(some features in PHP can use a real email address)
Install Apache HTTP Server:
* Run as a service will install itself as an 2000/XP service. This will auto
start every time windows boots, and the server will be accessible to all users.
* Run when started manually will provide an shortcut for you to start Apache.
If you plan to use Apache frequently pick the service, if for only occasional
use select the manual option.
I prefer to run as a service. Later I set the service to run as 'Manual', so it loads only when I want it.
Setup Type: Custom
Change the installation location if you prefer. (ex: C:\Program Files\Apache)
Testing: Once installed open your web browser and go to http://127.0.0.1/ or http://localhost/. If you are on a network and your computer has a name, you can also try http://your_computer_name/ or http://your_computer_ip_address_on_network/
Starting/Stopping: If you selected start manually, run the "Start Apache in Console" shortcut icon. If you want to start and stop the Apache service, go to Start -> Run and run: "net stop Apache" to stop or "net start Apache" to start. This only works in Windows 2000/XP. You may also Right-Click "My Computer" > Manage. In "Computer Management" > "Services and Applications" > "Services".
Once Apache is running it will show a "Test Page for Apache Installation" page. If you see this then the webserver is running as expected.
Unzip mysql-4.0.18-win.zip and Run: setup.exe in the mysql-4.0.18-win directory.
Destination Location: Change if you prefer. (ex: C:\Program Files\mysql)
Setup Type: Custom
Select only the components you want. If unsure, install them all.
MySQL will run as a service in Windows 2000/XP when the computer restarts. If you have 9x/Me you will need to go to the \mysql\bin directory and run "mysqld.exe". In 2000/XP, even though MySQL will start at bootup, it may not start immediately after it is installed. Go to Start > Run and run: "net start mysql". If that fails, you can run "mysqld-nt.exe" from the \mysql\bin directory.
Once the service is running, to see some basic info, go to \mysql\bin directory and run: winmysqladmin.exe
NOTE:IF you install MySQL in a folder other than c:\mysql or you intend to start MySQL on NT4/Win2000 as a service, you must create a file named c:\my.cnf or \Windows\my.ini or \winnt\my.ini with the following information:
[mysqld] basedir=C:/Program Files/mysql datadir=C:/Program Files/mysql/data
Change it to match your particular installation directory.
After your have installed MySQL, the installation directory will contain 4 files named 'my-small.cnf, my-medium.cnf, my-large.cnf, my-huge.cnf'. You can use this as a starting point for your own C:\my.cnf file.
Unzip php-4.3.6-Win32.zip
Create a directory for PHP (ex: C:\Program Files\php).
Copy all the files in \php-4.3.6-Win32\php-4.3.6-Win32 into the new directory (ex: C:\Program Files\php). So now you should have the file C:\Program Files\php\php.exe (or something similar, however NOT C:\Program Files\php\php-4.3.6-Win32\php.exe)
Copy php4ts.dll from the \php\ directory to the Windows
System directory:
c:\winnt\system32 (for Windows 2000/NT4)
or c:\windows\system32 (for Windows XP)
or c:\windows\system (for Win9x/Me).
Copy php.ini-dist as php.ini from the \php\ directory to your Windows directory: \windows (for 9x/Me/XP) or \winnt (for NT4/2000). Note the name change.
Open httpd.conf in your \apache\conf directory. Make the following edits. At the end of the file, add the following, make sure directory names are correct:
LoadModule php4_module "c:/program files/php/sapi/php4apache.dll" Change the following line ~385 From: DirectoryIndex index.html To: DirectoryIndex index.html index.php index.php3 index.phtml index.shtml index.htm Add the following line to end of the <ifmodule> section line ~849 # # To use server-parsed PHP files # AddType application/x-httpd-php .php .php3 .php4 .phtml
Now apache can handle PHP file processing. Restart Apache for the changes to take effect.
Create a file "test.php" and place it in the apache/htdocs
directory. Place the single line in it:
<?php phpinfo(); ?>
Then open the page: http://localhost/test.php.
You should see all the information about your PHP setup and Apache configuration
as well as other useful information.
Note: ALL changes to customize Apache are done by editing httpd.conf in your \apache\conf directory. Take care to backup this file before performing serious changes. Additionally Apache must be restarted each time for any changes to take effect.
All Apache pages are held in \apache\htdocs. To change:
Edit the following line ~301 DocumentRoot "C:/Program Files/Apache/Apache/htdocs" AND edit the following line ~326 <Directory "C:/Program Files/Apache/Apache/htdocs"> All directories in the conf files use a forward slash '/'. An example: DocumentRoot "C:/Documents and Settings/Administrator/My Documents/htdocs" <Directory "C:/Documents and Settings/Administrator/My Documents/htdocs">
Apache will be accessible to anyone who can access your computer. If you are on broadband (cable modem, DSL, T1, etc.) anyone maybe able to access your computer through a running webserver. You can use your local firewall application to lock out external users. This is the safe recommended method. You can also use Apache's internal methods to block out outside users, however this is not as secure as the previous method.
From the Apache documentation: Access and Allow and Deny. Read the documentation on how to configure these settings.
Edit the following line ~347 From: Order allow,deny Allow from all To: (locks out EVERYONE except the local machine) Order deny,allow Deny from all Allow from 127.0.0.1
Incomplete
Apache Documentation for Installing on Windows
Comments, suggestions, questions or any feedback welcome for this page or any of my Resources. Please use the contact link.
Help Out: If you found this guide or any Resource helpful, please consider supporting this site by recommending this page to others or linking to this page. I appreciate all the support I receive. Thank you in advance.
Disclaimer: The author makes no claim to the accuracy of the information provided. This information is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY. There is no implied support from referencing this guide. Any help that is provided is at will. Use this information at your own risk. Always make proper backups and use caution when modifying critical system files.
PLEASE DO NOT mirror, translate or duplicate this page without contacting me.
Copyright © 2003-2013 by Mauriat Miranda (mjmwired.net).