skip to Main Content

I configured PHP Xdebug with apache server and using Chrome. And it was working but then I played with other configuration and breakpoints stopped working.

So originally my working configuration is like this:

my php.ini:

[xdebug]
zend_extension="c:/wamp64/bin/php/php8.0.26/zend_ext/php_xdebug-3.2.2-8.0-vs16-x86_64.dll"
;xdebug.mode allowed are : off develop coverage debug gcstats profile trace
xdebug.mode =debug
xdebug.output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.log="c:/wamp64/logs/xdebug2.log"
;xdebug.log_level : 0 Criticals, 1 Connection, 3 Warnings, 5 Communication, 7 Information, 10 Debug Breakpoint
xdebug.log_level=7
;VBE change: ;xdebug.profiler_output_name=trace.%H.%t.%p.cgrind
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.use_compression=false
xdebug.client_port = 9002
xdebug.client_host = localhost

Window->Preferences->PHP->Server->Default PHP webserver

Server tab:

enter image description here

Debugger tab:

enter image description here

Window->Preferences->PHP->Debug

enter image description here

Window->Preferences->PHP->Debug->Debuggers->XDebug

enter image description here

Then I click Run->Debug as->PHP Web Application

Then it offers "Launch URL" dialog. I had to change path from
http://localhost/wp_leo/1/vbe_get_mem.php
to
http://localhost/3/1/vbe_get_mem.php

as Eclipse uses name of the project which is wp_leo but my actual path on server is just 3.

Then first time breakpoint worked. But then I played with configurations and at some point breakpoint stopped working. I got just "Break at first line" as it was checked in Window->Preferences->PHP->Debug. But all other breakpoints were ignored. So the question is why my breakpoints are ignored??????????

2

Answers


  1. Chosen as BEST ANSWER

    So after some eclipse crazy clicking I went to xdebug.log file. Searching for breakpoint and I got lucky there is command breakpoint_set. So I found:

    [22360] [Step Debug] <- breakpoint_set -i 897 -t line -f file:///http://localhost/3/1/vbe_get_mem.php -n 18
    [22360] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="897" id="223600006"></response>
    

    The path /http://localhost/3/1/vbe_get_mem.php -n 18 is actually correct path. But it does not work. I was wondering that maybe file:/// and http:// is weird combination. So I tried my debuger in CLI mode where breakpoint worked and there was used path:

    [20048] [Step Debug] <- breakpoint_set -i 967 -t line -f file:///C:%5Cwww%5C3%5C1%5Cvbe_get_mem.php -n 18
    

    Which looks wild but was working. So %5C is used instead of /. My document root is c:/www/ and path on server is 3/1/vbe_get_mem.php.

    Actually one thing that I was trying to configure was mapping path. Because I didn't like that every new file I debugged offered wrong path using project name instead of actual path on server and I need to manually rewrite it... So I played with Window->Preferences->PHP->Servers->Default PHP Web Server->Tab "Path Mapping". And probably that was mistake. Solution was to delete everything there and make it empty. Like this:

    enter image description here

    then breakpoint started working. And the path in xdebug.log started looking same as in CLI mode:

    [16188] [Step Debug] <- breakpoint_set -i 1972 -t line -f file:///C:%5Cwww%5C3%5C1%5Cvbe_get_mem.php -n 9
    

    Good luck...


  2. Path mappings should be directories, not URIs (such as http://).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search