D
D
Dmi3ii2018-02-15 14:19:06
PHP
Dmi3ii, 2018-02-15 14:19:06

How to set up XDEBUG in VS CODE?

Good afternoon.
Can't set up VS Code to work with xdebug while Netbeans handles breakpoints.

Configuration

Win 8.1 x64
VS Code 1.20.0 + PHP Debug 1.12.1
PHP 7.1.9
WAMP 3.1.0
php.ini
[xdebug]
; 2.6
zend_extension = "d:\wamp\bin\php\php7.1.9\zend_ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
; -not_working- zend_extension = "d:\wamp\bin\php\php7.1.9\zend_ext\php_xdebug-2.6.0-7.1-vc14.dll"
; -not_working- zend_extension = "d:\wamp\bin\php\php7.1.9\zend_ext\php_xdebug-2.6.0-7.1-vc14-nts.dll"
; -not_working- zend_extension = "d:\wamp\bin\php\php7.1.9\zend_ext\php_xdebug-2.6.0-7.1-vc14-nts-x86_64.dll"

xxdebug.remote_autostart = on
xdebug.remote_enable = on
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode=req
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "d:\wamp\bin\php\php7.1.9\zend_ext"
xdebug.remote_log = "d:\wamp\bin\php\php7.1.9\zend_ext\xdebug.log"

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": [
    // {
    //   "type": "chrome",
    //   "request": "attach",
    //   "name": "Attach to Chrome",
    //   "port": 9222,
    //   "webRoot": "${workspaceFolder}"
    // },
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9000,
      "stopOnEntry": true,
      "log": true
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9000
    }
  ]
}
index.php
<?php
$a = 1 + 1;
echo $a;
phpinfo();

I set the points, I press F5 in the debug console, it crashes:
spoiler

<- launchResponse
Response {
seq: 0,
type: 'response',
request_seq: 2,
command: 'launch',
success: true }

Point in VS Code doesn't fire (IE11, Chrome), unlike Netbeans. The second day I was tormented by climbing configs, please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmi3ii, 2020-01-31
@Dmi3ii

Maybe someone will come in handy:
--- configure xDebug [php.ini]
zend_extension = "d:\wamp\bin\php\php7.1.9\zend_ext\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
xdebug.remote_autostart= on
xdebug.remote_enable=on
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
--- VS CODE launch .json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"hostname": "127.0.0.1",
"port": 9001
}
]
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question