php – Visual Studio Code doesn't stop at breakpoints, PHPDebug/XDebug-ThrowExceptions

Exception or error:

Hello community!

I have a issue with my PHP Debug on Visual Studio Code (VSC). VSC doesn’t stop on any breakpoints settled in my script. I have checked the port 9000. It’s open when I run the PHP Debug in my VSC. Looking to the log it’s seems that XDebug works, but VSC anyway doesn’t stop on breakpoints.

Just in case if port 9000 is used by another application, I tried to change it to 9001 in php.ini and launch.json, and then I have restarted Apache to update PHP configuration, but VSC anyway doesn’t stop on breakpoints.

I have tried to install another version of extension of PHP Debug, but that didn’t fix my issue.

Any suggestions and/or advice are welcome. Details follow below. Reinstalling of VSC also did not bring me good news.

Thank you!

You can see my breakpoint here

Script:

<?php

  $i=0;
  $i=2;

  exit("\$i = $i end at ".date("Y-m-d H:i:s"));

?>

All installed stuff on my laptop:

macOS Catalina 10.15.3
XAMPP 5.6.40 Revision 1 with PHP5.6 and XDebug 2.2.5
Visual Studio Code 1.43.0 with PHP Debug 1.14.0

XDebug settings php.ini:

zend_extension=/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_autostart = 1
xdebug.remote_port = 9000
xdebug.show_local_vars = 1
xdebug.remote_log = /Applications/XAMPP/logs/xdebug.log

PHP Debug settings launch.json:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9000
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9000
    }
  ]
}

XDebug logs:

Log opened at 2020-03-14 03:38:14
I: Connecting to configured address/port: localhost:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/User888/Lab/backoffice/ping.php" language="PHP" protocol_version="1.0" appid="48376" idekey="User888"><engine version="2.2.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2014 by Derick Rethans]]></copyright></init>

<- breakpoint_list -i 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="1"></response>

<- breakpoint_set -i 2 -t line -f file:///Users/User888/Lab/BackOffice/ping.php -n 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id="483760002"></response>

<- breakpoint_list -i 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="3"><breakpoint type="line" filename="file:///Users/User888/Lab/BackOffice/ping.php" lineno="4" state="enabled" hit_count="0" hit_value="0" id="483760002"></breakpoint></response>

<- breakpoint_list -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="4"><breakpoint type="line" filename="file:///Users/User888/Lab/BackOffice/ping.php" lineno="4" state="enabled" hit_count="0" hit_value="0" id="483760002"></breakpoint></response>

<- run -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="5" status="stopping" reason="ok"></response>

<- stop -i 6
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stop" transaction_id="6" status="stopped" reason="ok"></response>

Log closed at 2020-03-14 03:38:14
How to solve:

Leave a Reply

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