Install PHP

PHP Installation on Windows

  1. Download Apache and PHP Software
  2. Run the Apache installer and install it in
    c:\eng\soft\apache\apache-2.2
  3. Run the PHP installer and install it in
    c:\eng\soft\php\php-5.3
    • Select Apache 2.2.x Module when prompted
    • For Apache Configuration Directory, use
      c:\eng\soft\apache\apache-2.2\conf\
  4. Re-start Apache in Windows Service: Control Panel -> View by: Small Icons -> Administrative Tools -> Services -> Apache2.2
  5. Add a testing PHP file in c:/eng/soft/apache/apache-2.2/htdocs/hello.php
    <html>
    <head>
      <title>hello</title>
    </head>
    <body>
        <?php echo 'Hello!' ?>
    </body>
    </html>
  6. Test the PHP installation with a browser
    http://127.0.0.1/hello.php
    Hello!

    If the browser displays the PHP code instead:

    • Apache is not configured with PHP module correctly. (Redo the PHP installation)
    • The PHP code is not embedded with <?php ?>

View & Troubleshoot PHP configuration

To view the system and php configuration as well as PHP pre-defined variables, hit a PHP page with

<?php
  phpinfo();
?>

Configure PHP with Xdebug for PHP Debugging in Windows

  1. Download PHP 5.3 VC6 (32 bit) Windows Binaries from xdebug.org
  2. Copy Xdebug 2.1.2 to
    c:/eng/soft/php/php-5.3/ext

Add to the end of php.ini (Replace my_host_name with your local host name)

/eng/soft/php/php-5.3/php.ini
zend_extension=c:/eng/soft/php/php-5.3/ext/php_xdebug-2.1.2-5.3-vc6-nts.dll
xdebug.remote_enable=true
xdebug.remote_host=my_host_name

Test Xdebug installation

Use php -m to verify Xdebug is installed

cmd> php -m

...
[Zend Modules]
Xdebug

PHP IDE Tool: Eclipse PHP Installation

  1. Download All-In-One Windows Eclipse PDT from http://www.eclipse.org/pdt/downloads/
  2. Create a directory
    C:\eng\soft\eclipse
  3. Extract the eclipse directory in the zip file to the newly created directory
  4. The directory should look like
    C:\eng\soft\eclipse\eclipse
  5. Rename it to
    C:\eng\soft\eclipse\pdt-3.0
  6. Run
    C:\eng\soft\eclipse\pdt-3.0\eclipse.exe

Install Eclipse Plugin

Eclipse Plugin Name Update Site
Subclipse http://subclipse.tigris.org/update_1.8.x

Create A Eclipse PHP Project

  1. Click on workbench
  2. In Eclipse, File -> New -> PHP Project
  3. Enter
    • Project name: MyApp
    • Create project from existing source: "C:\eng\dev\apps\myapp\www"

Configure Eclipse's PHP setting

  1. In Eclipse, Windows -> Preferences
  2. PHP -> PHP Servers
    1. New
      • name: MyApp Server
      • URL: http://your_host_name
      • Select Path Mapping
        • Path on server: C:\eng\dev\apps\myapp\www
        • Path in workspace: /myapp
    2. Set the newly created server as default
  3. PHP -> PHP Executables
    1. Add ...
      • Name: XDebug Configuration
      • Executable Path: C:\eng\soft\php\php-5.3\php.exe
      • PHP debugger: XDebug
  4. PHP -> Debug
    • PHP Debugger: XDebug
    • Server: MyApp Server
    • PHP Executable: XDebug Configuration

Make sure no other application is using port 9000 and 10000 in the localhost

Testing PHP Eclipse Installation

  1. Make sure Apache/PHP is running
  2. Right Click in index.php -> Debug As -> PHP Web Page
  3. Enter http://your_host/index.php

Install Memcached (Optional)

  1. Download Windows memcached binary v1.4.4 (Windows 32-bit zip file) from
    http://labs.northscale.com/memcached-packages/
  2. Unzip it to
    c:\eng\soft\memcached\memcached-win32-1.4.4-14
  3. In Windows, Start Menu -> Right Click on Command Prompt -> Run as Administrator
  4. Install as service
    Command prompt
    cmd> cd c:\eng\soft\memcached\memcached-win32-1.4.4-14
    cmd> memcached.exe -d install
  5. Go to the control panel -> service and start the newly created service "memcached"

Install Memcached Client

  1. Download php_memcache-cvs-20090703-5.3-VC6-x86.zip from
    http://downloads.php.net/pierre/
  2. Extract the DLL file inside the zip file to
    c:\eng\soft\php\php-5.3\ext
  3. Add behind PHP_EXIF DLL configuration
    c:/eng/soft/php/php-5.3/php.ini
    [PHP_MEMCACHE]
    extension=php_memcache.dll