Install Apache HTTP server, Tomcat, PHP (xdebug), MySQL on Windows 7 x64

Updated April 22, 2013.

Here only shows main steps and tips. For details and "how to", please google.

* Installation on Windows 7

  Due to UAC, the quick, simple and very important "First step" (before installing anything) is:
  1. Your user account should be in administrators group;
  2. Change "Owner" of "C:\Program Files\", "C:\Program Files (x86)\", "C:\ProgramData\" and "C:\User\<Your account>" to your account;
  3. Give full permissions to your account for above folders too.

  If you have installed following software before "First step", you have to uninstall them, delete anything relative in above folders and maybe in Registry. And then "First step". After "First step", following next steps.

* Installation packages

  The required files:
    Visual Studio C++ 2010 SP1 x64 runtimes ( (
    apache-tomcat-7.0.39.exe (, 32-bit/64-bit Windows Service Installer) (
    mysql-installer-community- (, MySQL Installer is 32 bit, but will install both 32 bit and 64 bit binaries.)
    mysql-workbench-gpl-5.2.47-win32.msi (

  The files for integration: ( (

   Note that Tomcat requires JRE 6 or 7; MySQL Workbench requires .NET Framework 4 runtimes.

* Installation orders

  Install them in following order:

    Apache HTTP server (Default: "C:\Program Files\Apache Software Foundation\Apache2.4")
    Apache Tomcat (Default: "C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0")
    PHP (Default: "C:\Program Files\PHP")
    MySQL (Default: "C:\Program Files\MySQL\MySQL Server 5.6")
    MySQL Workbench

  After installation or unzip, do not run them. If any one has been started automatically, stop it first.
  Set up configuration based on tips. In tips, "<Apache>", "<Tomcat>" and "<PHP>", etc. are their full path for short.

* Tips for setting up Apache HTTP server

  Modify following lines in "<Apache>\conf\httpd.conf":
    ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.4"
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.4/htdocs"
    <Directory "C:/Program Files/Apache Software Foundation/Apache2.4/htdocs">
  change to your website location.

  Change to "C:\Program Files\Apache Software Foundation\Apache2.4", open command line as administrator.
  Install it as a service by running "httpd.exe -k install".

  Unzip "" from "" to "<Apache>\modules".

* Tips for setting up Apache Tomcat

  Modify following line in "<Tomcat>\conf\server.xml":
    <Host name="localhost"  appBase="webapps"
  if you want to change "appBase" to another location. Then remember to copy those subfolders "host-manager", "manager" and "ROOT" from "<Tomcat>\webapps" to the new location. The new location can be same or different from the HTTP website location.

  To integrate with Apache HTTP server, create "<Tomcat>\conf\" file. You can find sample from Tomcat website ( Then modify "<Apache>\conf\httpd.conf" to add following lines according to (

    # Tomcat connector.
    LoadModule jk_module modules/
    JkWorkersFile "<Tomcat>\conf\"
    JkLogFile "<Apache>\logs\mod_jk.log"
    # All requests go to ajp13 by default.
    JkMount /* ajp13
    # Serve html, jpg and gif using httpd.
    JkUnMount /*.html ajp13
    JkUnMount /*.htm ajp13
    JkUnMount /*.php ajp13
    JkUnMount /*.jpg ajp13
    JkUnMount /*.gif ajp13

  If Tomcat's "appBase" location is different from HTTP server's location, add some more of following lines:

    # JkAutoAlias when WebServices location is different from Website location.
    JkAutoAlias "<Tomcat_appBase>"

* Tips for setting up Apache Tomcat with MySQL

  Create a schema "tomcat" and an user "tomcat" (password "tomcat") in MySQL.

  Copy "mysql-connector-java-5.1.24-bin.jar" into "<Tomcat>\lib".

  Modify "<Tomcat>\conf\server.xml", add following lines in "<GlobalNamingResources>" section:

      <Resource name="jdbc/GlobalMySQL"

  You can adjust the values.

* Tips for setting up PHP

  Modify "<Apache>\conf\httpd.conf", add following lines:
    # PHP
    PHPIniDir "<PHP>"
    LoadModule php5_module "<PHP>\php5apache2_4.dll"

  Modify "<Apache>\conf\mime.types", add following lines:
    application/x-httpd-php	php
    application/x-httpd-php-source	phps

  Copy "<PHP>\php.ini-development" to "<PHP>\php.ini", add following lines:



  You can add other extension dll in "./ext". PHP 5.4 includes xdebug, so no need to download separately.

* Tips for setting up PHP xdebug with Eclipse

  You can download the package of "Eclipse for PHP Developers", or "Eclipse IDE for Java EE Developers" with PDT plugin installed from "Install New Software...".

  Then refer to document "" for how to setup PHP and debuggers.

  From Eclipse "Windows/Preferences", in page "PHP/Debug", Check "Enable CLI debug".

  If the Eclipse project is a subfolder of WebSite, when first time running, open toolbar "Run/Debug Configurations.../PHP Web Page", uncheck "URL/Auto Generate", and manually input full relative path. For example, the project path is "<WebSite>/Web_Test/PhpSample1", the page file is "test.php".
  If check the "URL/Auto Generate", the generated path is "http://localhost" + "/PhpSample1/test.php". So, uncheck option, and manually change "/PhpSample1/test.php" to "/Web_Test/PhpSample1/test.php".

1 Comment (+add yours?)

  1. FH
    Nov 28, 2012 @ 19:38:39

    Thanks for the article, very helpful.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: