'PHP debugging in XAMPP

Is any debugger is installed by default in XAMPP/WAMP server or We have manually download and configure the debugger? Also do recommend the best PHP debugger.



Solution 1:[1]

If you want to use Netbeans and Xampp with debugging, simply open c:\xampp\php\php.ini and add these rows. It worked for me like a charm.

xdebug.remote_handler="dbgp"
xdebug.remote_enable=on
xdebug.remote_port =9000
xdebug.remote_enable = 1
xdebug.profiler_enable = off
xdebug.profiler_trigger = off
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.profiler_output_dir = "C:\xampp\tmp"

Or check this out: Check this out: https://www.youtube.com/watch?v=HbJOP0YcSjs

Solution 2:[2]

  • No debugger is installed by default in xampp
  • Yes, you've to manually configure it
  • Use Xdebug debugger

These steps worked for me. I'll describe my setup below

My setup: Win 10 Pro, XAMPP 7.3.33, IntelliJ IDEA

Summary

Summary - Installation

  1. Download xdebug DLL
  2. put some lines in php.ini
  3. Restart Apache

Summary - Usage

  1. Put a breakpoint in your code
  2. Start listening to debug connections on IntelliJ IDEA
  3. The debugger will pause at the line when that particular line gets invoked by the server

Details

All the details below have been taken from https://gist.github.com/odan/1abe76d373a9cbb15bed . All credit goes to them

Installing Xdebug for XAMPP with PHP 7.x

Requirements

Setup

If the file C:\xampp\php\ext\php_xdebug.dll already exists, you can skip the download.

[XDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug.dll"
;zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.7-7.4-vc15-x86_64.dll"
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
;36000 = 10h
xdebug.remote_cookie_expire_time = 36000
  • Restart Apache

  • Click the Github ? Star button :-)

PhpStorm

Netbeans

Visual Studio Code

Adobe Brackets

Sublime Text 2 and 3

Start debugger from the console

Enter cmd:

set XDEBUG_CONFIG="idekey=xdebug"
php test.php

Postman

Add XDEBUG_SESSION_START=PHPSTORM as query parameter to the url, e.g.

  • http://localhost?XDEBUG_SESSION_START=PHPSTORM

Follow me on Twitter | Blog

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Novasol
Solution 2 Dheeraj Bhaskar