Debugging mit VS code

allo zusammen,

jemand weiss wie kann ich ein brakepoint setzten in VSCode? Ich versuche mal den PHP code debuggen. Ich nuzte das development template.

vielen Dank

Jorge

1 „Gefällt mir“

PhpStorm ist aber wesentlich besser geeignet für diesen Zweck.

1 „Gefällt mir“

If someone is interested, here is how I get to debug the development template using VSCode:

  1. Go inside the app container and create a info.php in the public folder

2.  Copy the output into https://xdebug.org/wizard

  1. Follow the instruction and install xdebug.

  2. Add the following at the end of /opt/docker/etc/php/php.ini, make sure the zend_extension path is correct.

    [XDebug]
    zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
    xdebug.remote_enable = 1
    xdebug.remote_autostart = 1
    xdebug.remote_connect_back = 1
    xdebug.remote_port = 9090

  3. Close the container and restart it, this is important!

  4. Install "Xdebug helper " chrome extension.

  5. Install “PHP Debug extension by Felix Becker” VSCode extension

  6. Create a launch.json, add the paths you want to debug in pathMappings, and make sure you ignore vendor/ and var/  This is what works for me:

    {
    “version”: “0.2.0”,
    “configurations”: [
    {
    “name”: “Listen for XDebug”,
    “type”: “php”,
    “request”: “launch”,
    “port”: 9090,
    “ignore”:[
    " /vendor/ /.php",
    "/app/var/**/
    .php"
    ],
    “pathMappings”: {
    “/app/custom/plugins”: “${workspaceRoot}/plugins”
    }
    }
    ]
    }

  7. Set some breakpoints in your code and hit F5

  8. Happy coding

2 „Gefällt mir“