Php - Xdebug

About

Xdebug is a php debugger

The debug configuration can be found at All settings doc

Installation

From compiled with pecl

pecl install xdebug

From source with the Wizard

  • Go to the wizard
  • Fill in the output of php -i
  • Download the advised Dll

From the Historical list

Configuration

Xdebug 3

doc: https://xdebug.org/docs/remote#starting A lot of parameters have changed (https://xdebug.org/docs/upgrade_guide) but the most important are the connections one. ie:

  • xdebug.client_host
  • xdebug.client_port (9003 no more 9000)
[Xdebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so

; enable the debugger
xdebug.mode=debug

; Xdebug 3 - default debugging port has changed from 9000 to 9003.
xdebug.client_port=9003
; The standard windows name
xdebug.client_host=host.docker.internal

; log
; https://xdebug.org/docs/all_settings#log
xdebug.log="/var/log/xdebug/xdebug.log"

; https://xdebug.org/docs/all_settings#log_level
xdebug.log_level = 7

Xdebug 2

Php.ini: The important configuration parameters are:

  • xdebug.remote_enable to enable the debugger
  • xdebug.remote_host and xdebug.remote_port to define where the debugger should connect to.

Add the following lines in php.ini (for Php 5.3 and higher):

[Xdebug]
zend_extension=<path to php_xdebug.dll>
xdebug.remote_enable=1
xdebug.remote_port=<the port where Xdebug will send the debug data> (the default port is 9000)
xdebug.remote_host =<the hostname where Xdebug will send the debug data>
xdebug.profiler_enable=1
xdebug.profiler_output_dir=<AMP home\tmp> (AMP=Apache, MySQL, PHP)

Docker

For Docker, use the host: host.docker.internal. For more information, see this page on how to determine the ip of your docker host.

Verification

In Php - PhpInfo, you should see a Xdebug section

_


Powered by ComboStrap