InterServer Web Hosting and VPS

PHP Debugging Tools

Eclipse IDE is one of the top PHP IDEs. Nowadays it also supports languages like Ruby, Python or Javascript making it a scalable IDE to learn programming languages. Since it is an open source software, you can freely download its bundles and install it locally on your machine.

This tutorial will help you to install Eclipse PHP Development Tools (PDT) Plugin, Zend SDK for Eclipse, XDebug, XCache to debug php code.

PHP debugging in Notepad++

Sometimes, you don’t want an IDE to build some simple PHP projects. In that case, you can use a basic editor like Notepad++. With the help of the DGBP plugin, you can debug your PHP scripts in this editor itself. Systematic instructions to configure the setup are:

  • Considering you have Notepad++ installed on your system, download the latest version of Xdebug Plugin.
  • Unzip the folder and copy the Xdebug dll file, to the directory of PHP extension.
  • Next, you have to configure Xdebug to make it recognized by PHP. Open ini and add the following lines:
[xdebug]zend_extension_ts=”c:/wamp/php/ext/php_xdebug-2.0.3-5.2.5.dll”xdebug.profiler_output_dir = “c:/wamp/tmp/xdebug”xdebug.profiler_output_name = “cachegrind.out.%p”xdebug.profiler_enable = 0xdebug.profiler_append=0xdebug.extended_info=1xdebug.remote_enable=1xdebug.remote_handler=dbgpxdebug.remote_mode=reqxdebug.remote_host=”c:/wamp/tmp/xdebug/xdebug_remot.log”xdebug.show_exception_trace=0xdebug.show_local_vars=9xdebug.show_mem_delta=0xdebug.trace_format=0
  • Then, create the ‘xdebug’ folder and restart your Apache service.

To debug the PHP script on Notepad++, you need to install and configure the DBGP plugin:

  • First, download the latest version of the DBGP Plugin. The plugin installation is very simple, just unzip the folder, copy the dll file, to the Notepad++ plugins folder, and restart your editor.
  • Now, it’s time to configure DBGP. To open the configuration screen in Notepad++, Go to “ Plugins/DBGP/Config”:Configure DBGP

You will get a screen like this:DBGP Screen

Image source: stackoverflow

Here, the remote server IP is your server IP, and IDE is the value of the GET parameter. The next fields are remote and local source folders. While filling the details, make sure the setting specified in the php.ini file should match with IDE KEY and click Ok.

  • Open the PHP file you want to debug in the Notepad++ and add a breakpoint to the script. You will see the Notepad++ icon blinking on the taskbar. Click on it and start debugging.

What is Breakpoint?

Breakpoints are referred to as the points where you can intentionally stop or pause your program. If the debugger finds a breakpoint during execution, it stops at that point and enables you to check variables in debugging window and step through any code following the breakpoint.

You must set breakpoints in your files to inform the debugger where to stop during execution. A breakpoint can be set from the editor by clicking the left margin of the editor on the line. The breakpoint can be removed by clicking its badge.

You can also disable breakpoints temporarily. To do that just right click on breakpoint badge and deselect breakpoint enabled option. Which toggles the breakpoint into disable state from enable, you can see the grey badge in the left margin.

In these ways, developers can easily debug in code without refreshing multiple times in the browser that can save valuable time.


Xdebug is a free and open source project by Derick Rethans and is probably one of the most useful PHP extensions.
It provides more than just basic debugging support, but also stack traces, profiling, code coverage, and so on.

Some useful features of Xdebug

  • With Xdebug you can add a breakpoint and pause the execution of your script to see the state of your application at that time. Most of the modern IDE support Xdebug.
  • It completely replaces echo(), print_r() or var_dump().

Also Read: Start debugging your code easily with XDebug and Sublime

2. Kint

At first glance, Kint is just a pretty replacement for var_dump(), print_r() and debug_backtrace() that offers a better debugging experience.

Kint Debugger makes debugging and dumping variables a more pleasant experience. Kint Debugger integrates seamlessly with the Debug Bar plugin.

Kint is a tool designed to present your debugging data in the best way possible.

Here is a list of useful features of Kint

  • You can disable all Kint output easily so that you can easily debug on the live environment.
  • The variable name and file + line where Kint was called from is displayed.
  • CLI is detected and formatted for automatically.
  • Variable content is displayed in the most informative way – and you never, ever miss anything. Kint guarantees you see every piece of physically available information about everything you are dumping.


Whoops is a small library, available as a Composer package, that helps you handle errors and exceptions and handling and debugging them across your PHP projects very easily.
It’s an open source library with some great features.

  • Clean, compact, and tested code-base, with no extra dependencies
  • JSON & AJAX support
  • XML & SOAP support
  • Code view for all frames in a stack trace with line highlights

PHP debugging in NetBeans

Next, IDE is NetBeans, which offers a better user interface over other IDE’s for PHP development. It is a free open-source IDE for web developers. It includes all the tools required to create large-scale web apps and it supports almost all programming languages like PHP, C/C++, Java, and others.

To successfully debug PHP code in NetBeans, you should have PHP engine, the apache local web servers, as well as Xdebug, installed & configured. Here we are using Apache/PHP installation. Fortunately, XAMPP is already configured with Xdebug and includes the configuration in php.ini, you need to make only few changes & restart Apache.

  • Open php.ini in your editor. For us, it is likely in C:\xampp\php.
  • Locate the [XDebug] section and edit the values as shown below. Many of the values are defaults, but make sure you don’t have different values:
xdebug.profiler_enable = 1xdebug.profiler_enable_trigger = 1xdebug.remote_enable = 1xdebug.remote_host = “localhost”xdebug.remote_handler = “dbgp”xdebug.remote_mode = “req”xdebug.remote_port = 9000xdebug.trace_output_dir = “C:\xampp\tmp”
  • Restart your Apache using the XAMPP control panel.

Besides questioning the best IDE for PHP development, developers are asking the same question, Which IDE is best for PHP debugging? These three handpicked IDEs can supports PHP debugging compiled with Xdebug plugins. Configure your PHP Xdebug with any of these IDEs and ensure flawless web applications.


Krumo is designed to assist developers in debugging variables by providing a simple block that can be configured to display all of the elements of a given array or object. It displays structured information about any PHP variable

  • Krumo is an alternative to PHP’s built-in print_r and var_dump functions.
  • Krumo will print out a stack of variables using CSS and DHTML in the way that is more human readable than the alternatives.

5. Pinba

Pinba is a MySQL plugin and storage engine. It works as a real-time monitoring server for PHP running MYSQL.

Pinba is not a debugging tool in common sense since you’re not supposed to do debugging on production servers, but its main goal is to help developers to monitor the performance of PHP scripts, locate bottlenecks in real-time and direct developers’ attention to the code that really needs it.

PHP DebugBar

The PHPDebugBar integrates easily in any projects and can display profiling data from any part of your application. It comes built-in with data collectors for standard PHP features and popular projects. It displays a debug bar in the browser with the information from a PHP script.
Some key features of Debugbar-

  • Easy to integrate with any project
  • Clean, fast and easy to use interface
  • Handles AJAX request
  • Save and re-open previous requests

PHP debugging in sublime

The sublime is a text editor & IDE. This editor comprises various plugins, which makes debugging easier with several advanced debugging features. The main advantage of using Sublime is it allows you to easily extend with several packages. Here are the instructions for extending the Xdebug package:

  • Install sublime editor. If you already have, skip this step and continue with the integration of Xdebug with Sublime.
  • Next, you need to install Xdebug client package using the Sublime Text Package Control.
  • Go to Preferences -> Package Control and enter ‘Install Package’. As soon as repositories are loaded, type ‘xdebug‘ and select ‘Xdebug Client’.Xdebug

Image source:

  • Now, Xdebug might be installed but isn’t configured correctly yet. To configure, check your PHP info from the browser to verify and locate the xdebug ini
  • Open this file and make sure the following configuration is added:
  • Once the configuration is added and now you can start debugging.

Place breakpoint in one of your files, at a certain line by right clicking > Xdebug > Add/Remove Breakpoint. At this breakpoint, the website will freeze, and all available variables will be displayed in the debugging windows on the bottom of Sublime. You can set multiple breakpoints and step them one by one.

  • To start the session, go to Tools -> Xdebug -> Start Debugging. Now the debugging layout will appear in Sublime.


Eclipse is one of the most popular Integrated Development Environments that the PHP-developer uses to write, test, edit and debug server side scripts. It can also be set up for client-side scripts, although this is less common.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *