PHP Development Tools (PDT) Debugging

Notes

This documentation uses variables denoted with a $ followed by a keyword, all this emphasized with red text (i.e. $variable).  These variables should be replaced with appropriate values.  Suggested default values are denoted with a variable followed by an equal sign and a value (i.e $variable = value).

Requirements

Create a New PHP Server

  1. Open Eclipse
  2. Create a new PHP Server
  3. Select the Window > Preferences menu option
  4. Select the PHP > PHP Servers left menu option
  5. Click the New button
  6. Set the following fields
    Name: $domain
    URL: http://
    $domain
  7. Click the Finish button
  8. Click the OK button

Create a new Debug Configuration

  1. Open Eclipse
  2. Select the Run > Debug Configurations… menu option
  3. Double click the PHP Web Page option
  4. Set the following fields
    Name: $domain
    PHP Server: $domain
    File: Browse to the file belonging to this domain that you wish to debug
    Breakpoint > Break at First Line: Uncheck this if you do not wish to break at the first line in the file
    URL > Auto Generate: Uncheck if necessary (ending / in first checkbox and beggining / in second checkbox is OK)
  5. Click the Apply button
  6. Click the Close button

Debug a Configuration

  1. Open Eclipse
  2. Open a file associated with a Debug Configuration in the PHP Perspective
  3. Set a breakpoint on a line in the file by double clicking to the left of that line
  4. Select the Window > Open Perspective > PHP Debug menu option
  5. Select the Run > Debug Configurations… menu option
  6. Select the Debug Configuration you would like to debug
  7. Click the Debug button

Your browser will automatically open to the url in debug mode. Navigate back to Eclipse and you can see that processing has halted at the.

Open Source Software: