Locally Debugging a PHP Script

This procedure describes how to debug a PHP Script from your workspace using an internal PHP Executable.

 

 

Instructions on how to complete a procedure

To locally debug a PHP Script:

  1. Set breakpoints at the relevant places in the file that you would like to debug by double-clicking the vertical marker bar to the left of the editor.

  2. Save the file.

  3. Click the arrow next to the debug button on the toolbar and select Debug Configurations... -or- select Run | Debug Configurations....
    A Debug dialog will open.

  4. Double-click the PHP Script option to create a new debug configuration.

New Debug Configuration

  1. Enter a name for the new configuration.

  2. Select from the following options:

  • Workspace default PHP - Select  to use the default PHP and execution environment defined in the Execution Environments Preferences page.

  • Execution environment - Select the execution environment you would like to use for your debug configuration from the dropdown list.
    Click Environments to change the settings in the Execution Environments Preferences page.

  • Alternate PHP - Select to use another PHP which can be selected from the Installed PHP's list.  

  1. Enter your PHP file in the "PHP File" text field, or click Browse and select your file.

  2. Marking the "Break at First Line" checkbox will result in the debugging process pausing at the first line of code.

  3. If necessary, you can add arguments in the PHP Script Arguments tab to simulate command line inputs.

  4. Click Apply and then Debug.

  5. Click Yes if asked whether to open the PHP Debug Perspective.

A number of views will open with relevant debug information.

See the Running and Analyzing Debugger results topic for more information on the outcome of a debugging process.

Note:

If the file contains 'include' or 'require' calls to files which are not contained within the project, you must add them to the project's Include Path in order to simulate your production environment.