Optimizing Software Development
RSS icon Email icon Home icon
  • PHP 101: Setting-up an Environment for Development and Debugging

    Posted on February 8th, 2008 levent.gurses No comments

    After years of developing “enterprise” [read:big and bulky] software you are tired from the whole shebang J2EE/.NET and you are now looking for easy lightweight web development. PHP can be one of your choices.

    How do you start? Easy, just follow these steps to quickly setup a development environment with all servers, IDE and a debugger. In a few quick steps you will be able to setup:

    • XAMPP which comes with:
      1. Apache
      2. PHP 5.2.x
      3. MySQL 5.0.45
      4. Mercury Server (SMTP, FTP, etc.)
    • Zend Studio for Eclipse

    Let’s start:

    1. Download XAMPP 1.6.5 for Windows from http://www.apachefriends.org/en/xampp-windows.html#641
    2. Follow the intuitive setup wizard to install
    3. Download Zend Studio for Eclipse from http://www.zend.com/en/products/studio/
    4. Install Zend Studio
    5. To enable the Zend Debugger first navigate to XAMPP_HOME\php\zendOptimizer\lib and create a new folder Debugger. Create a new folder php-5.2.x under Debugger.
    6. Copy ZendStudio_HOME\plugins\ org.zend.php.debug.debugger.win32.x86_5.2.12.v20071210\ resources\php5\ZendDebugger.dll to XAMPP_HOME\php\zendOptimizer\lib\Debugger\php-5.2.x
    7. Open XAMPP_HOME/apache/bin/php.ini and add disable the Zend Optimizer while enabling the Zend Debugger:

      [Zend]
      zend_extension_ts = "XAMPP_HOME\php\zendOptimizer\lib\ZendExtensionManager.dll"
      ;zend_extension_manager.optimizer_ts = "XAMPP_HOME\php\zendOptimizer\lib\Optimizer"
      ;zend_optimizer.enable_loader = 1
      ;zend_optimizer.optimization_level=15
      ;zend_optimizer.license_path = "XAMPP_HOME\php\zendOptimizer\lib"
      zend_extension_manager.debug_server_ts = "XAMPP_HOME\php\zendOptimizer\lib\Debugger"
      zend_debugger.allow_hosts = 127.0.0.1
      zend_debugger.expose_remotely = always
    8. To verify the debugger, navigate to http://localhost/xampp and click the phpinfo() link. You should see the Zend Debugger information on the page such as
      This program makes use of the Zend Scripting Language Engine:
      Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
      with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
      with Zend Debugger v5.2.12, Copyright (c) 1999-2007, by Zend Technologies
    9. In Zend Studio, create a PHP project or use the sample project to start debugging
    10. Keep in mind that Zend Studio has two debugging modes: local and remote. In this example both are enabled. If you selected to install the Zend Firefox extension you can launch a debug session right from Firefox. Nifty.