Debugging PHP scripts

The instructions on this page explain how to debug PHP scripts running inside a IBM® WebSphere® sMash application.

Installation

  1. Install Eclipse PDT 1.0. The "All-in-One" package is easiest to install.
  2. Install the latest WebSphere sMash plugin for PHP

Preparation

  1. Open the PHP Perspective.
  2. Find the WebSphere sMash project you wish to debug. Right click the project > WebSphere sMash Tools > Resolve.
  3. Notice the "Include Paths" container at the bottom of the project. If you have dependencies that contribute PHP scripts, the scripts will be visible under this container. This container allows the PHP editor to perform content assist on included files.

Optionally, create a new WebSphere sMash application and follow these steps:

  1. Add a new PHP file under the app/scripts directory.
  2. Modify the WebSphere sMash application you wish to debug to have a reference to this new project as a dependency (using ivy.xml.)
  3. Perform a Resolve Local on the WebSphere sMash application you wish to debug.
  4. Notice that the app/scripts directory now appears under "Include Paths".

Debugging

  1. Open the PHP file you wish to debug.
  2. Double click the gray bar left of the line you wish to break on.
  3. Debug the project as a WebSphere sMash application. Note that breakpoints must be set before the application is launched.
  4. In the Debug perspective, notice that the Debug view contains a WebSphere sMash application. Under this entry are two members. One says "PHP Application" and the other says "zero.core.Main at localhost". If you do not see both of these entries, the plugin installation probably failed and debugging will not work.
  5. Do something to cause the PHP script to be invoked.
  6. Notice that the "PHP Application" entry expands and your PHP script is opened. If it is not, there may be a problem with the include path.

Information concerning include paths

The management of include paths is tricky because of the various ways they are used during development. The PDT "Include Paths" container serves only to aid with content assist during editing. It has no effect on the actual include path being used by the PHP engine. That is controlled by the zero.php dependency, which modifies the include path at runtime to contain the include_path setting from php.ini and the php directories found in each dependency.

Here are a few more items that may be included in a future version of the WebSphere sMash PDT Integration plugin.

  • Population of the Global Context view when a PHP thread is suspended.
  • Debugging into Java™ extensions from the PHP debugger.
  • Content assist for Java extensions.

Version 1.1.30763