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.

Note:

Your server must be running the Xdebug or Zend Debugger in order for remote debugging capabilities to function.

To debug a PHP Web Page:

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

2. Double-click the PHP Web Application option to create a new debug configuration.

Web Debug Server Page

3. Enter a name for the new configuration.

4. Select your server from the PHP Server list. If you have not yet configured your server, click New. The PHP Server Creation Wizard will open. Configure your server by following the instructions on 'adding a new server' under the PHP Servers Preferences page.

5. Under File, click Browse and select your 'debug target' file (the file from which the debugging process will start.)

6. The URL to be debugged will have been automatically created based on the file name and your server address. If the URL does not point to your debug target's location, unmark the Auto Generate checkbox and modify the URL.

7. To set up the options of a debugger that is attached to chosen PHP server, click on the Debugger tab.

Web Debug Debugger Page

8. To check whether your server connection is correctly configured, and that PDT can communicate with your server debugger, click the 'Test' button.

9. Select whether the Debugger should stop at the first line of code by marking/unmarking the 'Break at First Line' checkbox.

10. You can set some additional options that are related to the debugger type, e.g. the following options are available for Zend Debugger:

11. Click Apply and then Debug.

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

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

Note:

Since 7.1 PDT have support for Xdebug stack trace links. To enable this, in your php.ini add this line:

xdebug.file_link_format=xdebug://%f@%l

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. In addition, if a file defined with an absolute path to a server location (See 'Include Paths' for more on absolute file locations) is called, a Path Mapping dialog will appear. See Path Mapping for more information.