Broadcast on Broadcast off
The Documentation for Project Zero has moved. Please update your bookmarks to: http://www.projectzero.org/documentation/
Table of
Contents...
Hide
 

Debugging PHP scripts

The instructions on this page explain how to debug PHP scripts running inside a Zero application.

Installation

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

Preparation

  1. Open the PHP Perspective.
  2. Find the Zero project you wish to debug. Right click the project > Zero 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.
  4. For extra credit, create a new Zero application and add a new PHP file under the app/scripts directory. Now modify a different Zero application to pull this new project as a dependency (using ivy.xml.) Perform a Resolve Local, and notice that something 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 Zero application. Note that breakpoints must be set before the application is launched.
  4. In the Debug perspective, notice that the Debug view contains a Project Zero Application. Under this entry, you should see two members. One should say "PHP Script" and the other will say something like "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 Script" entry expands and your PHP script is opened. If it is not, there may be a problem with the include path.

Some notes for the curious

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 Zero 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.

r8 - 17 Jan 2008 - 19:27:24 - paynel
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site