Installing Apache/ MySQL/PHP on Windows - Part 1

By: Paul Newman

Page 1 of 2

Set for printing

Next

Have you been thinking about learning PHP or MySQL? Perhaps you've been curious about AMFPHP, the open-source Flash Remoting solution for PHP. In this tutorial, you'll learn an easy way to install Apache, MySQL, and PHP on the Windows platform.

In the past, installing Apache/MySQL/PHP on Windows was a tedious process, requiring you to download, install, and configure three different programs:

  • Apache HTTP Server (www.apache.org) — Apache HTTP Server is the world's most popular web server, used by more than 64% of the sites on the Internet. HTTP Server, along with PHP, is a project of the Apache Software Foundation.
  • MySQL (www.mysql.com) — MySQL is a very fast open-source database server. Version 5.0, still in development, will offer support for triggers and stored procedures.
  • PHP (www.php.net) — Depending on whom you ask, PHP either stands for PHP: Hypertext Preprocessor, or Personal Home Page. In any case, PHP is a server-side scripting language with a Perl-style syntax. Like ASP, JSP, and ColdFusion, PHP embeds code into standard HTML pages using special tags and filename extensions.

Deciding what files to download is the first hurdle. Do I download the beta, or the latest stable release? Is PHP 5.0 compatible with Apache 2.0? What version of MySQL do I need? Once you've installed the Windows binaries, you still have to get Apache, MySQL, and PHP to play nice together.

Fortunately, several open-source projects are trying to simplify the installation of WAMP (Windows/Apache/MySQL/PHP). Some of the more popular WAMP solutions include phpdev, AppServ, FoxServ, NuSphere, and PHP Triad. In this tutorial, we will download and install phpdev.

Installing phpdev

Recently, a company running LAMP (Linux/Apache/MySQL/PHP) asked me to design a Rich Internet Application. In order to test the application on my development computer, I needed to install Apache/MySQL/PHP. After struggling with FoxServ, I finally settled on phpdev. If you've come across a better solution, please use the feedback form at the end of this article.

NOTE: Because of the way it's configured, phpdev wants to be installed on the default port for HTTP servers (port 80). If you're already running IIS on port 80, you need to change the IIS port before installing phpdev:

1. Launch the IIS snap-in (Start > Administrative Tools > Internet Information Services).
2. Expand the console tree to reveal the Default Web Site.
3. Right-click Default Web Site and choose Properties.
4. Enter an unused port number in the TCP Port text box and click OK. (I chose 8080, but if you're running Tomcat on 8080, you should enter another, unused port.)



Verify the change by browsing to the new port (e.g., http://localhost:<port>/yoursite/).

Complete the following steps to install phpdev on your computer:

  1. Download phpdev from SourceForge.net to a folder on your computer.
  2. Double-click the executable file, phpdev423.exe, to launch the installer.
  3. If you want to install phpdev to another drive, edit the default installation folder:
    Figure 1
  4. Click Install.
  5. The installer copies the required files into the installation directory.
  6. When the installation is complete, the following command prompt appears:
    Figure 2
  7. The command prompt instructs you to run the appropriate batch file to start Apache and MySQL. Before you do this, open the file in Notepad (e.g., C:\phpdev\2K-NT-XP-phpdev_start.bat). The Windows NT/2000/XP version contains the following code:

    cd c:\phpdev\apache
    start apache -k start
    cd c:\phpdev\
    start apachemonitor.exe
    cd c:\phpdev\mysql\bin
    start mysqld-nt.exe --standalone
    start http://localhost/
    exit

  8. Ensure that the paths in the batch file are correct. If not, revise them and save the file.

TIP: Apache Monitor is a little app that runs in your system tray. It displays a green arrow if Apache server is running, and a red square if it is stopped. Apache Monitor only works if you install Apache as a service, which is covered in Part 2 of this tutorial.

If, like me, you find little use for Apache Monitor — I prefer to use the Services snap-in to stop/start services — you can comment out lines 3 and 4. Comments in batch files use the REM command or a double colon:

REM Comment the next lines if you don't want to use Apache Monitor
:: cd c:\phpdev\
:: start apachemonitor.exe

  1. Double-click the batch file for your platform to start Apache and MySQL.

This opens the phpdev home page in your browser:

Figure 3

The phpdev home page lists the files and folders in your web root (e.g., C:\phpdev\www). In addition, this page links to phpMyAdmin and two sample applications: phpWebSite and Invision Discussion Board (IBForums).

Page 1 of 2 1 2 Next



Downloads are disabled during your trial period.


Keywords
php, phpdev, apache, mysql, amfphp, http server, windows