DEV Community

Pablo
Pablo

Posted on

Debugging PHP with XDebug and VsCode

https://www.youtube.com/watch?v=LNIvugvmCyQ
http://xdebug.org/wizard

At .bash_profile add export XDEBUG_CONFIG="idekey=VSCODE"

.vscode/launch.json

"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,
            "runtimeExecutable": "/Applications/MAMP/bin/php/php8.0.0/bin/php"
        }
    ]
Enter fullscreen mode Exit fullscreen mode

/Applications/MAMP/bin/php/php8.0.0/conf/php.ini

[xdebug]
  zend_extension = /Applications/MAMP/bin/php/php8.0.0/lib/php/extensions/no-debug-non-zts-20200930/xdebug.so
  xdebug.mode=debug
  xdebug.start_with_request=yes
  xdebug.remote_enable=1
  xdebug.remote_autostart=1
  xdebug.client_port = 9000
  xdebug.client_host = "127.0.0.1"
  xdebug.idekey = VSCODE
Enter fullscreen mode Exit fullscreen mode

Top comments (0)