Last updated: 2006/01/15
Return to the main page
When you are making a web page, the easiest way of view a page stored in your hard disk is double-clicking in the file, which usually results in the page being opened in your default browser. Although this method (which I still use sometimes) it's good enough for simple static pages, it's not useful if you you are using server side languages (PHP, Perl, ASP...), or even for pages that are static but use links relative to the server root (like "/index.html" or "/css/styles.css"). In this situations the solution is either upload the files to the server of your web host (quite cumbersome, and not feasible or desirable if the site is already open to the public) or set up a test server in your local network/computer, which is the quick and safe way of testing your design changes.
I'll try to describe in a simple way how to set up an Apache server on Windows for testing purposes, with the option of include PHP and MySQL. This can be useful even if your web host runs on Linux/FreeBSD/Unix, since the funtionality will be more or less the same (unless you use specific OS/server features). It can also be useful for learning and/or testing popular Apache modules like mod_rewrite that are not directly available for other servers (e.g. IIS)
Only PHP is covered since is free and widely used nowadays (ASP is tied to IIS and Perl users probably prefer Linux :-). The same reasons apply to MySQL. I'm going to describe how to set up a standalone Apache server and then how to add PHP and MySQL, so people that don't need PHP or MySQL can skip those steps.
Since testing is the primary goal here, I won't discuss the security practices related to Windows+Apache+MySQL+PHP. But with a simple step you can secure your test server from external attacks: configure your firewall to block all Internet access to the server, as only your computer (or your local network) needs access to it.
On other hand, don't think that test servers doesn't need any protection. If you leave the server open to Internet, you'll be exposed in the same way as production web sites, since hackers/crackers usually scans ranges of IP numbers looking for known vulnerabilities instead of targeting specific web sites.
Among all the versions available I'm going to use Apache2, PHP 4.4.x and MySQL 4.0.x for this tutorial. Apache2 because it's designed for working more efficiently on Windows than Apache 1.3.x while maintaining the compatibility, PHP 4.4.x because most production environments haven't migrated to PHP 5.x yet, and MySQL 4.0.x because versions 4.1 and higher only works with PHP 5.x . I don't provide the direct links to the files since these sites rely on mirrors for the downloads, and they release frequent minor updates/fixes, and therefore the file names change.
Apache: http://httpd.apache.org/download.cgi
Download the Win32 Binary (MSI Installer) (apache_2.0.xx-win32-x86-no_ssl.msi).
PHP: http://www.php.net/downloads.php
Download the Windows binaries, both the ZIP package (php-4.4.x-Win32.zip) and the
Installer (php-4.4.x-installer.exe).
MySQL: http://dev.mysql.com/downloads/mysql/4.0.html
Download the Windows (x86) package (mysql-4.0.xx-win32.zip).
phpMyAdmin: http://www.phpmyadmin.net/home_page/downloads.php
A popular MySQL administration tool. Download the ZIP package (phpMyAdmin-2.x.x-plx.zip).
Page: 1 2 3 4 5 Next: Setting up Apache
Return to the main page