PhpED: PHP IDE
new features
features
version comparison
features: php tools
php debugger
php profiler
php scripts
features tour
licensing
php testing
PhpED difference
PhpED on Mac/Linux
testimonials
PhpDock
Nu-Coder
PhpExpress
TechPlatform

Php Debugger in NuSphere PhpED

Every program no matter how well written can have bugs or other defects - there's no exception to this rule, including in your PHP scripts or any other software program that you develop. Debugging is the process of finding the bugs so they can be fixed and the PHP Debugger is the best tool for helping you find the bugs fast and eliminate them from your PHP programs. You can setup remote debugging in PhpED with the help of debug PHP Settings Wizard and DBG Wizard. For information about supported platforms and how to install PHP Debugger modules please check debugging PHP on various platforms page.

How to debug a PHP script

There are many techniques used for PHP debugging, varying from desperate PHP code inspection to angry keyboard slamming. A less extreme and more useful approach would be to use print statements and logging embedded in your PHP code, printing out variable values throughout various stages of the program execution.

This approach works well in general, however suffers from several drawbacks, for example:
  • It requires significant additional coding effort, which ironically can introduce even more bugs into your php script
  • Debugging of PHP with print statements is a highly repetitive process - it's impossible for a developer to lock onto a problematic region of code while printing everything and everywhere
  • Introduction of so many print statements and conditional can affect the performance of your PHP application.
PHP Debugger
PhpED's PHP Debugger provides a powerful and easy way to simplify PHP debugging because it gives you complete visibility and control over the execution of PHP scripts and doesn't require that you make any changes to your PHP code. With PhpED's PHP Debugger you can:
Special Feature

How to use PhpED's PHP Debugger

PhpED's PHP Debugger will let you step through your php code, control the execution flow, see the current values of all variables in the script as well as content of the arrays and classes at each stage or even assign different values to the variables on the fly and do all of it without making any changes to php application. This brief tutorial will help you to learn how to use PhpED's PHP Debugger.

Step through lines of php code

Single-Stepping through a PHP script in PHP Debugger
PhpED's PHP Debugger lets you step through the execution of a php scripts, line-by-line, just as you would using a conventional software debugger. Using the PhpED Debugger toolbar, you can:
  • Step-In: Execute the next line of php code.
  • Step-Out: Return to the line of php code that called the function you are in.
  • Step-Over: Execute the current line of php code.

Inspect Call-Stack


The Call Stack window displays the function calls that brought you to the current script location. The top of the Call Stack window lists the last function called by your script. Below this is the listing for the previously called function. The listing continues, with the first function called in your script located at the bottom of the list. The Call Stack window also shows the names of member functions (or methods). Each member function is prefixed with the name of the class that defines the function.

Inspect any variable or class in PHP

Debugger Watch tab in PHP Debugger
PhpED's PHP Debugger three ways to see the values of the variables or the members of the PHP class.
  • The value of the variable is shown when the cursor is hovered over the variable in PHP code
  • The values of the Local variables and classes are displayed in Locals tab of PhpED debugger
  • The values of the Global variables and classes are displayed in Globals tab of PhpED debugger
  • Variables and classes added to the Watch tab of PhpED debugger and displayed there


Assign a different value to PHP variables in the script

Changing value of a PHP variable in PHP Debugger
The PhpED PHP Debugger will let you assign a different value to any PHP variable. This feature allows you test your fix before you change the actual PHP code in the script.

Set/toggle break points to interrupt php script execution

Debugger Breakpoints in PHP Debugger
PhpED allows you to easily set and toggle breakpoints anywhere in your PHP code. The lines of code highlighted in blue represent breakpoints. The line in red shows the PHP script current state. You can set/toggle breakpoints from a toolbar, by typing the "F5" key, or by clicking on the red dot to the left of the line of code.
Learn more about PHP Debugger Breakpoints here

Call PHP function on the fly and inspect the results

Debugger Immediate tab in PHP Debugger
Using Immediate tab of PhpED debugger you can call any php function on the fly in the middle of the execution of your PHP script. Simply type in the function call in the window and press Enter. The functionality of Immediate tab is illustrated here:


PHP Debugger Settings
You can PhpED automatically switch to debug mode when there are PHP errors or exceptions occuer in the code. To set this behavior and other settings for PHP Debugger or Profiler use Tools->Settings->Run and Debug
Php Debugger Evaluate/Modify
The Evaluate/Modify window displays a non blocking dialog that can be used to evaluate an expression, which is too complex for the simple tool tip hint provided by the debugger and when the use of Watch is unnecessary. If the cursor is placed over a variable in the script, the variable under the cursor will be evaluated automatically and displayed in the dialog. The dialog is not modal so you can continue debugging session w/o closing this dialog.

Remote Debugging with SSH Tunnel

SSH Tunnels can be used for the communications with PHP Debugger on remote server. Using SSH Tunnels on SSH equiped remote server you can getrid of the headache of dealing with Firewalls and Routers. Learn more about setting up remote PHP Debugging communication on SSH Tunnels page

Remote and Local debugging of PHP CLI scripts

PHP CLI Debugging
Debugging is also available for Command Line Interface PHP scripts. To set up Remote Debugging of CLI script you need to select Remote Server as a Run Target in project properties and specify Terminal account to login to the remote server as well as Php executable to be used for CLI run
PHP CLI Debugging
This is of course not neccassary for local debugging of PHP CLI scripts. To run or debug PHP scripts select CLI (Console) from Run menu (HTTP is for regular Web Server scripts debugging)

In this tutorial you learned about the many features of the PHP Debugger and how to use them to quickly find and eliminate bugs from your PHP scripts. You can watch a live demonstration of using the PHP debugger and advanced remote PHP debugging from our video tutorial library. Additional technical information is available on the NuSphere Forum. Download a free trial of our PHP Debugger today!

Nusphere PhpED 15.0

 Download NuSphere PHP IDE

Download a free trial of the fast PHP EDitor and robust Integrated Development Environment for PHP.

 Buy NuSphere PhpED® now

Best PHP Editor and complete PHP IDE.
NuSphere PhpED 15.0 is available from our online store front.
"To be honest its bloody awesome, I have looked at loads of PHP editors and this is THE only one that actual works straight out of the box!!! Brilliant, well done."
Andrew Breward,
Director of Technology
caboodal.com

 Guide

Walk through NuSphere PhpED interface
PhpED video tutorial: Webservices
Learn how to add webservices to your code in less than 5 minutes (a flash demo).

 Special Team4 Offer

Get 4 copies of PhpED for the price of 3!

Optimum solution for development teams.
PhpED 15.0 Team4
Need more than 4 licenses? Contact Us for more quantity discounts, please use "Ordering/Payment issue" subject on the form.

 Dr. Dobb's

Dr. Dobb's

Dr. Dobb's Magazine covers NuSphere PhpED in New and Noteworthy section.

 InfoWorld

infoworld.com
PhpED is a proper, world-class IDE for PHP code. It is the only IDE worth considering if PHP development is your primary job