Click here to visit Microsoft's Windows XP Home Page.

Apache Web Server for Windows The World's Most Secure Web Server
Windows XP Home Edition no longer includes nor will it run any Microsoft web server. Alas, the world will not end! The most widely used web server in the world (Apache) actually runs well under Windows XP. There are some added benefits as well. The last Apache web server to be hacked was about five years ago! And you now will be able to run identical web applications on every UNIX, Linux, and Windows 2000 and XP system you own. This document provides a simplified explanation of how to install, configure, and get Apache 1.3 running under Windows XP in less than 30 minutes. If you'd rather do it the hard way, here's the official Apache documentation. To begin, download the software from here. There is no software license fee for Apache.

PHP for Windows The Best HyperText Preprocessor on the Planet
If you liked Microsoft's Active Server Pages (ASP) and Visual Basic (VB), then you'll love PHP. Think of it as a hypertext preprocessor on steroids! In addition to being a full-featured programming language, PHP can also be used to seamlessly integrate almost any data base into your web pages. And PHP natively handles file uploads and the generation of images, sound, Acrobat documents, and just about anything else you can dream up. Once Apache is installed, you're ready to load PHP4. Begin by downloading the software from here. A Windows HTML Help File version of the PHP4 Manual is also available here. There is no software license fee for PHP.

MySQL for Windows SQL Data Base Apps in Minutes, Not Months
Yes, you can integrate Oracle and Informix databases and any other data base that is ODBC compliant into your web pages with PHP. But, for quick and dirty projects, nothing comes close to MySQL for ease of development and performance. In fact, PHP natively supports MySQL, and a web-based front-end processor to build MySQL applications is available for download here. Take a look at this sample PHP/MySQL application template which can be used to display any data base in about 10 minutes. Some day you may need to actually review the MySQL documentation. To begin, read our quick deployment guide after downloading MySQL for Windows from here. There is no software license fee for MySQL.

Installation Getting Started
Download the Apache software onto your XP machine. Make sure the Admin Services window is closed before beginning the install. The Apache installation software is compressed into a single .msi file. Using Windows Explorer, locate the downloaded .msi file and double-click on it to begin the installation. Accept all of the defaults. Fill in a name for your domain and server. Choose "Run as a Service" when prompted. This will automatically load Apache each time you boot up the XP machine. If warned that IP is not configured properly, ignore the warning if you are sure that your XP system has IP connectivity.

Web Browser Test Is Apache Running?
Check to be sure the Apache server is running by opening a web browser and entering the following address: http://localhost/. If the default Apache page displays, proceed to Configuring Apache below. Your page display should look like this. If the page does not display, see Troubleshooting below.

Troubleshooting What Went Wrong?
On some XP systems, Apache fails to install itself as a service. This means the server does not start up automatically. First, we will make certain that you have not implemented the XP firewall feature which blocks incoming web access. Then we will check to see if Apache was installed as a service. If not, we will need to be sure Apache will start from the command prompt. Then we will manually install it as a Windows service.

To verify that you are not blocking Internet web traffic with XP's firewall feature, click Start, Control Panel, Switch to Classic View, Network Connections, Local Area Connection, Properties, and Advanced. If the Internet Connection Firewall box is checked, either uncheck it or click on the Settings button and check the Web Server box to allow incoming web traffic.

To determine whether Apache loaded as a service, choose Start, Control Panel, Switch to Classic View (if not already there), Administrative Tools, Services. Scroll down the alphabetical list looking for an Apache entry. If it's there but doesn't show as Running, click on the Apache entry, and then click Start. If it shows Running, repeat the web browser test above. Otherwise we will start Apache from a command prompt to be sure the software installed properly.

To start Apache manually, move to the following diectory (if you accepted the default installation directory when you installed the software): C:\Program Files\Apache Group\Apache\. Then type apache to start the web server. If it shows Running then all is well. Press CTRL-C to stop the server.

Now install Apache as a service by typing the following command: apache -i -n apache. A message should display indicating that Apache was installed as a service. Now return to the Admin Services window, check for Apache again and Start the service. Then perform the web browser test again. All should be working at this point. Reboot your XP system just to be certain.

Configuring Apache C:\Program Files\Apache Group\Apache\conf\httpd.conf
Configuring Apache for Windows is handled identically to other versions of Apache. The main configuration file is httpd.conf which is stored in the directory shown above. Complete documentation on configuration options is available on Apache's web site. Out of the box, Apache is configured to operate reliably with PHP and MySQL.

Installation Getting Started
Download and unzip the PHP software into a new C:\PHP directory on your XP machine. Be careful to preserve the directory structure in the archive.

Assuming you have installed Apache as a Windows Service, add the following two lines to the very end of the Apache configuration file (httpd.conf) as outlined in Configuring Apache above:

  LoadModule php4_module c:/php/sapi/php4apache.dll
  AddType application/x-httpd-php .php

While you are editing the httpd.conf file, go to the top of the file and search for DirectoryIndex. Replace the existing line with the following entry:

  DirectoryIndex index.html index.php

Download the PHP.INI file from here and save it to your Windows directory, usually c:\WINDOWS on XP systems. Review the settings in the file and change the SMTP server address and email address to meet your needs.

Copy the file C:\PHP\php4ts.dll to the Windows system directory which is \windows\system32 for most XP systems. Now restart the Apache web server by issuing the following commands at command prompt:


Complete documentation on installation of PHP Advanced Features is available in the install.txt file located in C:\PHP after installation.

Web Browser Test Is PHP Running?
To test whether PHP is functioning properly, create a TEST.PHP file using Notepad with the following text on a single line:

  <?php phpinfo(); ?>

Save the TEST.PHP text file to the following directory (assuming you accepted the default Apache directory during your install of Apache):
  C:\Program Files\ApacheGroup\Apache\htdocs

Using a web browser, enter the following address: http://localhost/test.php. Your browser should display a detailed listing of all the Apache and PHP settings on your system. To see a sample display, click here.

Activating PHP Extensions Bringing PHP Up to Warp Speed
The real power of PHP lies in the dozens of library extensions available for your use. By way of example only, these add-on libraries give PHP direct access to POP3, IMAP, Oracle, Informix, dBASE, other ODBC, and Notes databases as well as the ability to generate and display PDF, XML, ZIP, LDAP, and image files. There also is support for CyberCash payment systems and calendar and language functions of every imaginable kind. To use any or all of these functions, they first must be activated in the PHP.INI file. Some also require moving certain .DLL support files into the Windows search path. To save you some time, the PHP.INI file (downloaded above as part of the installation) activates some of these libraries. If, however, you wish to use OpenSSL, PDF, LDAP, IMAP, or POP3 functions, the following steps are required. See the Function Reference under Contents in the PHP Help File for a complete listing of other available libraries.

1. Unremark the desired function in the PHP.INI file in your C:\WINDOWS directory by deleting the semicolon at the beginning of the appropriate line. Search for extension=php_ in the file to find the extension section. Verify that there also is a line in your PHP.INI file which reads extension_dir = c:\php\extensions. Save the modified file.

2. Copy all of the files from C:\PHP\DLLS to your Windows System directory (usually C:\Windows\System32 on XP machines).

3. Stop and restart the Apache web server: NET STOP APACHE then NET START APACHE.

4. Rerun the PHP test outlined above: http://localhost/test.php. The various functions you activated should now display as enabled.

Installation Getting Started
Create the following directories if they do not already exist: C:\MYSQL, C:\MYSQL\data, C:\MYSQL\ibdata, C:\MYSQL\iblogs, and C:\MYSQL\temp.

Download and unzip the MySQL software into a temporary directory on your XP machine: C:\MYSQL\Temp.

Begin the MySQL installation by running Setup.exe from the temporary folder you created.

Download the sample MY.INI configuration file into your Windows directory, usually C:\WINDOWS on XP systems. This default configuration will enable use of InnoDB transaction tables to improve performance. Two 2GB files are created as your maximum file storage space. If this doesn't meet your needs, edit the MY.INI file.

MySQL Test Is MySQL Running?
Now we are ready to test MySQL start up. From a command prompt, move to the C:\MYSQL\BIN folder. Issue the following command: mysqld-max --standalone. You should see a series of InnoDB messages indicating that the 2GB files are being created. This is normal.

Once you are certain that MySQL can be started from the command prompt, you will need to install it to automatically start as a Windows service.

Shut down the MySQL server if it is running: mysqladmin -u root shutdown.

Issue the following command from the C:\MySQL\BIN folder after making certain that you have closed the Admin Services window (if open): mysqld-max-nt --install.

Check to make sure MySQL is running as a Windows service. Choose Start, Control Panel, Switch to Classic View (if not already there), Administrative Tools, Services. Click Start if the MySQL entry does not display as Running.

Administering MySQL phpMyAdmin
Once Apache, PHP, and MySQL all are running, you are ready to install the phpMyAdmin software. Download and unzip the phpMyAdmin software into a folder (which you must create) below the root web hosting directory. Make sure you preserve the directory structure in the archive when you unzip the files. Here's the folder to create:

  C:\Program Files\Apache Group\Apache\htdocs\PHP

Test access to the software by using a web browser to access http://localhost/php/. Don't forget the trailing slash or the page won't load!

Once you are sure the software works reliably, you need to lock it down so that anyone with a web browser can't access and reconfigure your MySQL databases.

Using Notepad, create a file named .htaccess with the following entries and copy it to the PHP folder created above:

  AuthName "Enter password"
  AuthType Basic
  AuthUserFile C:/Program Files/Apache Group/Apache/bin/.htpasswd
  require valid-user

Move to the C:\Program Files\Apache Group\Apache\bin directory, and run the password creation program: htpasswd. The syntax for the program will be displayed. Here's an example which will be needed to create the .htpasswd file and get you started: htpasswd -c .htpasswd johndoe. This will create the .htpasswd file with an entry for johndoe. You will be prompted to enter a password for the user. To add an additional user, issue the following command: htpasswd -b .htpasswd marydoe voodoo. This will add a new marydoe user with a password of voodoo.

Edit Apache's config file using Notepad: C:\Program Files\Apache Group\Apache\conf\httpd.conf. Search for the line AllowOverride None and change it to read AllowOverride All. This permits directory-by-directory management of password access to web files. If you forget this step, .htaccess files will be ignored.

Stop and restart Apache (NET STOP APACHE then NET START APACHE). Then test file access again by closing and reopening a web browser to access http://localhost/php/. You should be prompted for a username and password before phpMyAdmin displays. If not, check syntax and the locations of the files created above.

MySQL Security Lock It Down!
In true Microsoft tradition, MySQL for Windows installs out of the box wide open. This means any user anywhere with the IP address of your XP machine can access, change, and destroy all MySQL databases without your knowledge. Apache and XP usernames and passwords have no effect on MySQL access! For some, this situation may not be entirely desirable. The default MySQL configuration establishes two users (root and everyone else) and two accounts for each (localhost and everywhere else). Assuming your MySQL server is in a safe place, leaving localhost access available without a password is helpful since PHP always makes its access this way. Thus, all you really need to do to secure MySQL is create passwords for the non-local accounts of root and everybody else ... and then keep an eye on your XP machine, of course. Keep reading to learn how to do that. If you want a more elaborate password system or wish to set up special security on specific databases, then consult and RTFM.

To set a password for non-local account access by root and everybody else to "voodoo," change to the C:\MySQL\BIN directory and issue the command: mysql -u root mysql. At the MYSQL prompt, type the following commands making sure you end the first two commands with a semicolon:

  update user set password=PASSWORD('voodoo') where host='%';
  flush privileges;

Just to be on the safe side, stop and restart the MySQL server: NET STOP MYSQL then NET START MYSQL.

Visit our other web sites or send comments and suggestions to Ward Mundy