Webservers on Windows - Apache, Mysql and Php Installation

WAMP installation for dummies

Introduction

After yet another post on php.windows mailing list by users on “how do make mysql work” and viewing some (often incorrect) installation instructions I’ve decided to do a “Windows Installation for Dummies” for people who seem to have trouble with WAMP (Windows, Apache, Mysql, Php) installs. I’ll also include some supplementary information for IIS and PHP, alternate dbs, and adding php extensions.

There are many open source projects that are available on windows. Some of the more famous made their way on linux and unix servers first, and have since migrated to other platforms. This deals with a well known combination commonly referred to as LAMP (Linux, Apache, Mysql, Php [or Perl depending on who you talk to]). These programs together make a powerful, easy to use webserver. WAMP (Windows, Apache, Mysql, Php) is a similiar acronym that is slowing becoming popular as the windows world finds out about great open source programs. This article attempts to walk you through installing the programs on windows quickly and efficiently, and in ways that make upgrading painless.

Five steps to a webserver

  1. Prepare OS
  2. Download Software
  3. Install Apache
  4. Install Mysql and Admin Tools
  5. Install and configure Php


Step One - Prepare OS

OS stands for operating system. Before you start throwing a bunch of new programs on your computer you need to make sure you’ve done the proper preparation. First of all, you’ll need a copy of windows installed on your computer. Don’t try this on windows 98, 95 or ME unless you’re insane - you really need at least windows NT, XP or newer is recommended. Make sure windows is installed properly and not infected with viruses, spyware, or other undesirables. Also apply all service packs and windows updates! You’d be surprised how many people try to put software on a messed up or non-patched windows install and then complain when things don’t work. It might also help to defragment your hard drive, make sure you enough memory (RAM) and storage space (on your hard drive) to accomodate the new load you’ll be applying.

Apache will run two items in the task manager - one around 15M, one around 23M, Mysql will run one 10-12M for a rough memory estimate. Remember that although apache and mysql don’t take up much space on disk, they may take up a lot of space with things like ever growing database tables, lots of session files, even large transactions. Plan for the space you’ll need. Once you have a functioning, fully patched copy of windows and enough hard drive and ram space for the new programs then we can move on to the next step

Step Two - Downloading Software

Since you already have the W of WAMP ready, you need to download the other three parts. If you would rather run IIS (Internet Information Server - Microsoft’s server solution) - perhaps you need to use ASP pages for another project or something - you can skip this download. First the apache server. Currently there are three branches (basically three versions) of apache available. The 1.3.x branch (version 1.3.34 as of today), the 2.0.x branch (2.0.55 as of today) and the beta 2.1.x branch (2.1.8-beta as of today). Why are there three versions? The 1.3.x branch is the old, very stable version that was first designed on linux. The 2.0.x branch is an improved version that runs much better on windows. The 2.1.x is beta - that means it’s still in development and you shouldn’t use it on a production server, but if you want to try it at home and find some bugs you’re welcome to. You’ll want the “best available version”, currently 2.0.55 from http://httpd.apache.org/download.cgi - get apache_2.0.55-win32-x86-no_ssl.msi. That’s the windows installer version.

Next you’ll need mysql - although you can use another database program instead. If you already have a license for microsoft sql server, php can interact with that just fine. You can also use oracle, postgresql, firebird, interbase, and many other databases, so if you’re used to another database’s quirks, don’t think you HAVE to use mysql because you’re using php. However, Access is NOT a good choice for a webserver database - php has a flat file solution (sqlite) if you’d prefer that to a full featured database server.

If you’d like to use a different database you can skip this download.
Mysql has recently moved to “two editions” - much like redhat split out fedora. The website provides a brief summary of the differences between the two. Now that 5.0 is the offical version that’s the one you should download - the 4.1 version will be phased out and the 4.0 and 3.23 branches are in effect dead. Unless you need the embedded version of the server, get the windows essentials installer - you’ll need to scroll down the page and choose a mirror.

You have two choices for managing your mysql server, web software or windows management tools. If you’re going to be doing remote management a web software package will be the most logical choice (see the appendixes), if not mysql provides two windows gui management tools. Mysql Administrator has server health monitoring, performance optimization, backup capabilities, server information, replication status, server logs, service control, user management, and database browsing with a gui tool. It is cross platform, but was originally windows only. Mysql Query Browser is a visual query program and can be used to manage data. I found the query browser interface to be a bit strange at first, but once I figured out how everything worked I enjoyed using it.

Last, but not least, you’ll need php. Like apache, php has two main branches, the 4.x branch and the 5.x branch. Most php software currently available is written for 4.x and most production servers still use this version. The 5.x branch has many improvements, including a new object/class system. However, the current 5.0.x versions of php tend to be slow and exceptionally buggy on windows and I wouldn’t recommend them. If you’d like to use php 5 features, probably your best bet would be to use 5.1 snaps. Snaps are “snapshots” compiled from the source code on a regular basis. Although they usually work great they can be dangerous on a production server. 5.1 is currently in RC status - that is there have been several “release candidates” completed, and hopefully the official 5.1 release will be soon. If you want php4 make sure you download the PHP 4.4.1 zip package , not the installer version. For php5 versions, use snaps.php.net and download the one of the links under Win32 Package and Latest CVS (5.1.x-dev). There are also pecl (php extensions) dll’s available. (see the appendixes for more information)

Now, you should have an apache msi, a mysql msi, a php zip file, and possibly one or two msi’s for mysql management tools. On to the next step

next page

Pages: 1 2 3 4 5

6 Responses to “Webservers on Windows - Apache, Mysql and Php Installation”

  1. Lew Eichorn Says:

    We have had to copy libeay32.dll, libmhash.dll, libmysql.dll, ssleay32.dll, yas.dll from php directory to either the apache2 bin directory or windows system32 directory in order for php to find corresponding extensions.

  2. auroraeosrose Says:

    Then you didn’t read the directions carefully enough - add the path to the php directory to your path environment variable AND RESTART THE COMPUTER - I know a lot of people say you don’t have to restart after changing PATH but I can’t get that to work on windows XP pro - restarting fixes it. Also if you have problems with php_mysql.dll or php_mysqli.dll make sure the path to libmysql.dll comes BEFORE the path to your php dir in the path variable, otherwise the wrong libmysql.dll will get used.

  3. Gabe Says:

    Do you know anything about adjusting the cpu utilization of apache under windows? Some data processing PHP scripts I’ve been running are executing rather slowly, and when I check the task monitor, the CPU usage never goes above 10%rnrnI’d like to see apache use 100% when running these scripts..

  4. louis Says:

    Have you a way to connect to PICK/UNIVERSE databases with php?

  5. auroraeosrose Says:

    I don’t know that much about it but according to google theoretically you can connect to PICK/UNIVERSE with an odbc driver - so you’d have to install the driver in windows and create an odbc dsn and connect to it via php’s http://us2.php.net/odbc functions - but no, there is not a native way to connect to that database using php

  6. bob Says:

    Hi! I setup SSL/TLS on apache 2.0.rnIts working fine apache only listen on 443 port for incoming connections. My question is:rnHow to config apache , for example when user type www.dome.com to automatic redirect him to port 443 and https connection. Now when i use www.domain.com he dont display anything because apache don listen on 80.rnCan you help me, please? Thanx :)

Leave a Reply

November 2005
S M T W T F S
« Aug   Dec »
 12345
6789101112
13141516171819
20212223242526
27282930  
Register
Login