User Guide > Tasks > Debugging Files and Applications > Debugging a PHP Web Page

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 Zend Debugger or XDebug in order for remote debugging and profiling capabilities to function.
The Zend Debugger comes bundled with Zend Server, but can also be downloaded as a separate component from http://www.zend.com/en/products/studio/downloads. For instructions on manually installing the Zend Debugger, see Installing the Zend Debugger.

 

 

Instructions on how to complete a procedure

To debug a PHP Web Page:

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

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

 

New Debug Configuration

  1. Enter a name for the new configuration.

  2. Select the Server Debugger to be used (by default this will be the Zend Debugger).

  3. 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.
    For more information on configuring the communication between Zend Studio and your remote server, see Setting Up Remote Debugging.

  4. To check whether your server connection is correctly configured, and that Zend Studio can communicate with your server debugger, click the 'Check Debug Server Connection' button.

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

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

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

  8. For further Debug options, select the Advanced tab, which has the following options:

New Debug Configuration - Advanced

  • Open in Browser - Mark if you would like the application to be displayed in Zend Studio's internal browser while it is debugged.

  • Choose whether to:

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

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

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

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

  • Source Location - Choose whether the source files used during this session will be taken from the server or from a local copy.
    If a local copy is not available, files will be taken from the server. Selecting the 'Local Copy' option will result in the Path Mapping mechanism being applied when files are called. See the Path Mapping topic for more details.

  1. Click Apply and then Debug.

  2. 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:

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.

 

 

Related Links:

Setting Up Remote Debugging

Debugging

Locally Debugging a PHP Script

Debugging a PHP Script

Debug Preferences

Debugging a URL

Locally Debugging a PHP Script

Running and Analyzing Debugger Results

 

 

©1999-2013 Zend Technologies LTD. All rights reserved.