简体   繁体   中英

xdebug skips breakpoints in IntelliJ Idea

Issue

Upon executing a PHP Web Page debug configuration, PHP skips over -all- breakpoints in my web application. Nothing is logged to the xdebug log. The debugger outputs "Waiting for incoming connection with ide key 'XYZ'" where XYZ is the IDE key generated for that session.

Exception

If I manually place an "xdebug_break();" statement in PHP, PHP stops at breakpoints; but, I can't see scoped variables and the xdebug log gets logged.

I'm running

  • IntelliJ IDEA Ultimate 2017.3.1 Build #IU-173.3942.27
  • XAMPP Windows 5.6.32
  • PHP 5.6
  • Xdebug 2.5.3-5.6

XAMPP Virtual Host Settings

<VirtualHost 127.0.0.2:80>
DocumentRoot "C:/dev/testphp"
ServerName 127.0.0.2
ErrorLog "C:\dev\testphp\logs\apache.error.log"
CustomLog "C:\dev\testphp\logs\apache.custom.log" common
</VirtualHost>

Xdebug PHP.ini Settings

[Xdebug]
zend_extension=C:/xampp/php/php_xdebug-2.5.3-5.6-vc11.dll
xdebug.default_enable=1

xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.remote_host=127.0.0.2
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.remote_mode=jit
xdebug.remote_log=C:/xampp/apache/logs/xdebug.log

; xdebug.profiler_enable=1
; xdebug.profiler_enable_trigger=1
; xdebug.profiler_output_dir=C:/xampp/apache/logs/logs/profiler

I've tried the following:

  1. Checking breakpoints are enabled (they are).
  2. Setting up xDebug from scratch with the Zero-configuration Web Application Debugging with Xdebug and PhpStorm . The same issue appears.
  3. Checking my Firewalls. PHPStorm, IDEA, and Apache are all set to Allow.
  4. Validated Debugger Configuration on Web Server (everything checks out)
  5. Created a fresh project with a basic PHP file to test if project specific (same issue appears)
  6. Reinstalling XAMPP from scratch (Hail Mary. Same issue appears).
  7. I've tried researching the issue too, but the above appears to be the standard solutions.

EDIT 1:

Weird. It's working now after a fresh restart. I played with the options and determined that the likely culprit was xdebug.remote_mode=jit

I'm not 100% confident (i recall playing with that option last Friday); but, when I turn it on, it does trigger the aforementioned bug I reported.

Note: This is likely not a bug but expected behavior and myself not fully understanding how Just-In-Time mode works.

EDIT 2:

Update: weird things are occurring. It works fine on my test project, but not on my main project .

Test Project When I tried "#4 Created a fresh project with a basic PHP file to test if project specific (same issue appears)" I created an index.php file that prints the Fibonacci sequence. Xdebug catches the breakpoints I set in that file

Main Project: When I drop breakpoints in PHP for an ajax call fired after page load, the breakpoint is ignored. When I drop a breakpoint in PHP for a page as its beign constructured in my controller, the breakpoint is ignored --Weirdness-- IF I open both projects as separate windows, the test project runs fine; but, if I execute a debug configuration for the main project, the page that pops up sits on "waiting for 127.0.0.1" which corresponds to the ip address for the main project in the apache virtual host. By comparison, 127.0.0.2 corresponds to the test project. Meanwhile the test project window opens up the debugger and pauses on the 1st line of the index.php file for the main project and a warning that the file is outside the project.

EDIT 2.1:

Fixed.

Xdebug ports didn't match up.

PHP INI specified port 9000 for xdebug. The projects' xdebug settings specified port 9000 for the test project and port 9001 for the main project. Closing the test project and updating the main project to 9000 fixed this.

Weird. It's working now after a fresh restart. I played with the options and determined that the likely culprit was xdebug.remote_mode=jit

I'm not 100% confident (i recall playing with that option last Friday); but, when I turn it on, it does trigger the aforementioned bug I reported.

Note: This is likely not a bug but expected behavior and myself not fully understanding how Just-In-Time mode works.

Edit: Make sure you update your IDEA settings for xdebug too. If the ports don't match up, IDEA will never connect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM