Section C.7. Running the Debugger

C.7. Running the Debugger

This section describes the procedure for running the Debugger.

Zend Studio supports two debugging capabilities:

  • Internal Debugger. Allows the developer to debug stand along PHP applications (requires only the Client installation).

  • Remote Debugger. Allows the developer to debug files using a remote web server.

  • Debug URL. Allows you to run the debug procedure on pages currently mounted on the web site.

The difference between internal and remote debugging is primarily in the initialization of the two procedures. Once the Remote Debugging session is running, the procedure is the same.

C.7.1. Internal Debugger

Use the "Tip of the Day" dialog box to access sample code and a short explanation on debugging:


Start Zend Studio Client; alternatively, select Help > "Tip of the Day".


From the "Tip of the Day" dialog box, click . The file DebugDemo.php opens in the Editing window.


In the Toolbar of the Zend Studio Client, click to start the Debugger. The icon appears while Zend Debug Server runs, and remains onscreen until the Debugger detects a breakpoint at Line 46.


Click (Step Over) multiple times until the cursor arrives at Line 51.


Place and hold the cursor over $worker_name, $worker_address, and $worker_phone. A ToolTip appears displaying the variable values.


Click ( the Step Into button. The Debugger advances to Line 26.


In the Debug window, click the Stack tab and click the node to the right of row_color. The call stack tree expands displaying variable i.


Click the Step Out button. The cursor arrives at Line 51.


Click the right arrow button). Output appears in the Output window; a Notice appears in the Debug Messages window.


In the Debug Messages window, double-click on the Notice. The cursor jumps to Line 61 in the Editing window.


Place the cursor in the Debug Output window, right-click and select Show in Browser from the shortcut menu. A browser window appears with the Output window contents.

C.7.2. Remote Debugger

The Remote Debugger is very similar in its features to the Internal Debugger, except the code is executed on a remote Web Server. If you want to debug a typical browser-based web application, refer to the "Debug URL" section later in this appendix.

In order to use the Remote debugger, the Studio Client and server must be configured first.

To configure a Zend Studio Server refer to the "Configure Studio Server for Debugger and Profiling" section later in this appendix.

To configure Studio Client:


From the main menu, select Tools > Preferences. The Preferences window appears.


Select the Debug tab.


From the Debug Server Configuration area of the Debug tab, select a Debug Mode (Server/Internal).


Click OK.

You can now debug the current file using the Remote Debugger.


You can also enable/disable Remote Debugging from the Project Properties window. Typically, this is done at the time the project is created.

C.7.3. Debug URL

Debug URL allows you to run the debug procedure on pages currently mounted on the web site. You can initialize the debug session from the Studio Client by selecting the 'Debug URL' menu or Zend Browser Toolbar.

Zend Studio Server gives the files you are working on first priority when debugging. In order to achieve this, the Server application follows this hierarchy when it requests files:


Checks if the file called is currently open in the Zend Studio Client; if found, it uses this file.


Searches for the file in the open project's path; if found, it uses this file.


Searches for the file in the server path; if found, it uses this file.

Because of this hierarchy, you can often avoid uploading your latest revisions. For example, if you browse on your web site and find that one of the pages in the site is corrupted, you can initialize a debug session on that page directly from the browser with the Zend Browser toolbar. After finding and fixing the problems, you can initialize a new debug session on the same URL and use your browser to view the new result without first uploading the files that were changed.

    PHP 5 Power Programming
    PHP 5 Power Programming
    ISBN: 013147149X
    EAN: 2147483647
    Year: 2003
    Pages: 240

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: