Search code examples
phpvisual-studio-codexdebug

Visual Studio Code won't stop at breakpoint in PHP Xdebug


I have move from my Thinkpad laptop to HP Elitebook. I must set my development environment in my new laptop. After setup my Visual Studio Code and XAMPP in Windows 10 Pro 64 bit edition, I can't debug my PHP code.

I have properly installed Xdebug extension for Visual Studio Code, and make sure the php.ini correct. This is my setting for php.ini (I use portable XAMPP which is placed on E: drive):

zend_extension = "E:\xampp\php\ext\php_xdebug-2.4.1-5.4-vc9.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_log="E:\xampp\apache\logs\xdebug.log"

And my xdebug.log show information like this :

Log opened at 2018-10-27 05:56:45
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:///E:/xampp/htdocs/absen/index.php" language="PHP" xdebug:language_version="5.4.3-dev" protocol_version="1.0" appid="7112" idekey="william"><engine version="2.4.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>

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

Log closed at 2018-10-27 05:56:45

But my Visual Studio Code won't stop at breakpoint.

I have reinstall my Visual Studio Code, XAMPP, and using another Xdebug version but it still doesn't work.

I have follow these links:

None of these solutions work.


Solution

  • Finally i know the source of problem. The HP Elitebook have preinstalled program named HP Velocity, which used port 9000.

    The issue is port 9000 from my host is bind to port 9000 of HP Velocity software. When HP Velocity service connect to the localhost xdebug server, logs say that connection is ok, but it is connected to HP Velocity.

    I changed xdebug port to 9090 in php.ini and changed in launch.json on visual studio code. After that, my visual studio code work as usual and can stop at breakpoint.

    Hope this help others :)