Debugging a PHP Web Page

This procedure describes how to debug whole applications, projects, files or collections of files that are already on the server. Using the debugging process, you can also create an application in PDT and publish it to the server before debugging.

Note:

Your server must be running the Zend Debugger in order for remote debugging capabilities to function.
The Zend Debugger comes bundled with Zend Core and Zend Platform, but can also be downloaded as a separate component from http://downloads.zend.com/pdt/server-debugger.

 

 

Instructions on how to complete a procedure

To debug a PHP Web Page:

  1. Set breakpoints at the relevant places in the file that you would like to debug and save the file.

  2. Save the file.

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

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

 

  1. Enter a name for the new configuration.

  2. Select the Server Debugger to be used. PDT supports both the Zend Debugger and XDebug.

  3. Select your server from the list.
    If you have not yet configured your server, click the underlined 'PHP Servers' shortcut. The Servers preferences page will open. Configure your server by following the instructions on 'adding a new server' under the PHP Servers Preferences page.

  4. Under PHP File, click Browse and select the first file which launches your application.

  5. If the files do not yet exist on the server, you will need to publish them before they are debugged by doing the following:

  1. Ensure that the Publish Projects to this Server checkbox is marked within the Server settings, and specify the Directory to which the files should be published. (To do this, click Configure under the Server category.)

  2. Mark the Publish files to Server checkbox and, if necessary, add the root folder to which you would like to publish the file in the 'Publish To' box.

  3. Ensure that the URL is correct. If it is not correct, unmark the Auto Generate checkbox and manually change the URL.

  1. For further debug options, select the Advanced tab, which has the following options:

  2. Open in Browser - Mark if you would like the application to be displayed in PDT's internal browser while it is run.

  3. Choose whether to:

  4. Debug All Pages - The specified page and all the pages linked to it are debugged. The browser waits for the debug of each page before displaying it.

  5. Debug First Page Only - Only the first page is debugged.

  6. Start Debug from - Select the URL from which you would like the Debugging process to start.

  7. Continue Debug from this Page - Selecting this option will result in all the pages linked to the URL being debugged.

  1. Click Apply and then Debug.

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

Click here for more on Running and Analyzing the debugging process.

 

 

Related Links

Related Links:

Working with the Debugger

Debugging

Debugging a PHP Script

Debug Preferences

Locally Debugging a PHP Script

Running and Analyzing Debugger Results

Run Menu