WAMP - ing

Windows / Apache / MySQL / Php.

This is a diversion from my usual immersion in all things Oracle. Along with my blog at http://www.ba6.us I've got a handful of sites that are quick and dirty custom webapps that I host on BlueHost.com. BlueHost, like many consumer level web hosts offers Apache, MySQL, and Php on the cheap.

I wanted an environment I could use for development and experimentation. Here is how to set up a simple dev environment for Apache / MySQL / Php on a Windows machine…

1) Windows

I'm not going to cover installation of Windows here.

The only thing I can think of right now is to turn off IIS if you want to install Apache on the default Port 80. I am using Windows XP Pro on a HP Laptop and it doesn't look like IIS was installed so I'm safe there.

2) Apache HTTP Server

You can find the latest Win32 Binary package here: http://httpd.apache.org/download.cgi

It is supplied as a .msi file, so once you launch it it will guide you through the installation. I accepted the defaults for everything.
The software was installed in the C:\Program Files\Apache Software Foundation\Apache2.2 directory. There is now a Service called Apache that you can stop and start. Hit http://localhost to see the default webpage.

3) MySQL

You can find the Windows (x86) ZIP/Setup.EXE here: http://www.mysql.org/downloads/mysql/5.0.html

Again I accepted all the defaults. Browse through the Custom Installation if you want to see what other packages tag along with the install.

I also downloaded and installed the GUI tools while I was at it:
Look for the Windows (x86) .msi file here: http://www.mysql.org/downloads/gui-tools/5.0.html

When you are done the installed software can be found here: C:\Program Files\MySQL

4) Php 5.x

Install this last because PHP needs to know about the Apache and MySQL.

You can find the PHP 5.2.0 Installer here: http://php.net/downloads.php#v5

For this component select eh Custom install and make sure you select the Extensions for the databases you will be connecting to. None are selected by default and it can be frustrating to figure out what's missing sometimes. I selected MySQL and Oracle.

When you install it will ask you for the Apache Configuration Directory. Point it to the C:\Program Files\Apache Software Foundation\Apache2.2\conf directory. When the install is completed you can find the installed files in the C:\Program Files\PHP directory.

Note! There seems to be one brain dead default entry in the php.ini. Open C:\Program Files\PHP\php.ini and update the session.save_path setting. I was getting session.save_path = "c:\temp"

5) Getting Started

There are plenty of resources out there to get started.

If you get deeper into this stack you might think about using a Framework like CakePhp or Zend Framework. A Framework helps fast forward your development by taking care of many common tasks for you (Session handling, db connections, etc). Keep in mind, every framework can do things a little differently so there is some learning curve. But source code is usually available if you need to jump into the nuts and bolts.
There is a good overview of Php Frameworks in this phpit.net article. You can learn more about the Model-View-Controller Pattern in this phparch.com article.

6) Have fun developing!

After you create a web application locally, to deploy it you will need to:
1) export your MySQL structure and data from your local server and import it into your production MySQL server
2) Copy your php application to the production Apache webroot
– Dave

Add new comment