Install Apache HTTP server, Tomcat, PHP (xdebug), MySQL on Windows 7 x64 Updated April 22, 2013.

구글링으로 Windows 64bit 환경에서 아파치 2.4.2, 톰캣 7.0.42, 그리고 jk 커넥터를 다운로드 하는 곳과

설치법을 찾았다.


32bit 환경들은 쉽게 접할수 있으나 64bit 환경은 자료가 많지 않아 아래의 링크를 따라 가면 된다.


특히, 커넥터는 누군가 64bit 환경에서 빌드해놔서 정말 고맙게 사용하고 있다.


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 (http://www.microsoft.com/download/en/details.aspx?id=13523)
    httpd-2.4.4-win64.zip (http://www.apachelounge.com/download/win64/)
    apache-tomcat-7.0.39.exe (http://tomcat.apache.org/, 32-bit/64-bit Windows Service Installer)
    php-5.4.14-Win32-VC9-x64.zip (http://www.apachelounge.com/download/additional/)
    mysql-installer-community-5.6.11.0.msi (http://www.mysql.com/downloads/installer/, MySQL Installer is 32 bit, but will install both 32 bit and 64 bit binaries.)
    mysql-workbench-gpl-5.2.47-win32.msi (http://www.mysql.com/downloads/)

  The files for integration:
    mod_jk-1.2.37-win64.zip (http://www.apachelounge.com/download/win64/)
    mysql-connector-java-5.1.24.zip (http://www.mysql.com/downloads/)

   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 "mod_jk.so" from "mod_jk-1.2.37-win64.zip" 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\workers.properties" file. You can find sample from Tomcat website (http://tomcat.apache.org/connectors-doc/reference/workers.html). Then modify "<Apache>\conf\httpd.conf" to add following lines according to (http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html).

    # Tomcat connector.
    LoadModule jk_module modules/mod_jk.so
    JkWorkersFile "<Tomcat>\conf\workers.properties"
    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:

    <GlobalNamingResources>
      <Resource name="jdbc/GlobalMySQL"
        auth="Container"
        type="javax.sql.DataSource"
        driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/tomcat"
        sername="tomcat"
        password="tomcat"
        maxActive="30"
        maxIdle="20000"
        maxWait="120"/>
    </GlobalNamingResources>

  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:
    extension_dir="ext"

    [PHP_MYSQL]
    extension=php_mysql.dll

    [Xdebug]
    zend_extension="ext/php_xdebug.dll"
    xdebug.remote_enable=true
    xdebug.remote_host=127.0.0.1

  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 "http://www.eclipse.org/pdt/articles/debugger/os-php-eclipse-pdt-debug-pdf.pdf" 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".