This tutorial will teach you how to debug files and applications to gain maximum efficiency and accuracy from your PHP code.
Zend Studio's Debugging feature can detect and diagnose errors in PHP code situated locally or on remote servers. The debugger allows you to control the execution of your program by setting breakpoints, suspending launched programs, stepping through your code, and examining the contents of variables.
Debugging should be used at stages where your scripts and applications are formed sufficiently to be tried and tested.
In this tutorial, you will learn:
Our first step is to create a new local PHP project to work with in this tutorial.
|
|
|
To create a new local project:
|
Next, we will begin to develop our application by adding a new PHP file to the project.
|
|
|
To create a new PHP file:
|
|
By default, Zend Studio is configured to stop debugging at the first PHP line in the code. Our next step is to add an additional breakpoint to specify where in the code the debugging process should pause.
|
|
|
To add breakpoints in your code:
|
To learn how to add conditions to a breakpoint, see Setting Breakpoints. |
We will now debug the file as a CLI application using Zend Studio's internal debugger.
|
|
|
To debug the file as a CLI application:
|
To run the debugging process again with the same configuration, click the debug icon on the toolbar. To change debugging configurations, in the menu-bar, go to Run | Debug Configurations. |
Zend Studio also allows you to debug applications, projects or files that are located on a server. You can debug either the local (Workspace) copy of files or the server copy of files.
|
|
|
To debug as a Web application:
|
To run the debugging process again with the same configuration, click the debug icon on the toolbar. To change debugging configurations, in the menu-bar, go to Run | Debug Configurations. |