Skip to content
Advertisement

VS Code PHP Debugging without xdebug.remote_autostart=1

How can I use the PHP debugger withing VS Code without the following setting in PHP.INI?

xdebug.remote_autostart=1

This setting makes apache extremely slow.

Before I used PHPStorm and this supplied a parameter un the URL that triggered the debugger. I wonder if this is possible in VS Code too.

I use VS Code 1.53.2 with the PHP extension pck from Felix Becker.

Before someone asks: I switched to VS code although I loved PHPStorm because PHPStorm is unusable on my Surface pro X due to bad performance. VS Code has a Windows Arm implementation!

Advertisement

Answer

Use xdebug v3 instead of v2:

For Xdebug v3.x.x:

[xdebug]
zend_extension = //path to xdebug dll file
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000

In xdebug v3 you can use xdebug.start_with_request = yes instead of xdebug.remote_autostart = 1

make a simple test.php file, put a phpinfo(); statement in there, then copy the output and paste it into the Xdebug installation wizard. It will analyze it and give you tailored installation instructions for your environment.

If you are using “PHP Debug” extension by “Felix Becker” in “VS Code” you will see more instructions at extension’s details.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement