Breakpoint on Vscode not hit with lumen framework

Viewed 550

I have a problem when I want to debug and see data on breakpoints it's not hit with lumen framework here my launch.json on vscode

{
    // 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": [
        {
            "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
        }
    ]
}

Other information 1. installed xdebug v2.9.2 2. vscode version is 1.43.0 3. PHP v7.3.15 4. lumen v5.6 5. both of the OS I using XAMPP

previously I using windows, on windows the breakpoints are hit, but now migrated to macOS it's not working. On macOS from another project, for example, using CodeIgniter or just simple PHP it's hit the breakpoints.

Please help me

1 Answers
  1. Install xdebug first - [https://xdebug.org/docs/install] Install
  2. Install Xdebug helper for Chrome - [https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc] (Use appropriate plugin for any other browser)
  3. Enable Debug mode in Xdebug helper in Chrome (Or relevant plugin for any other browser)
  4. Install PHP Debug extension for VS Code - [https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug]
  5. Serve lument project php -S localhost:8000 -t public
  6. Print <?php phpinfo(); ?>, by adding $router->get('/', function () use ($router) { return phpinfo(); }); into routes/web.php
  7. Comment exiting code for $router->get('/' if applicable
  8. Open localhost:8000 in Chrome
  9. Find xdebug.ini or 20-xdebug.ini or similar
  10. If the file is not there find php.ini
  11. Add following to xdebug.ini or php.ini depends on your x-debug version [https://docs.devsense.com/en/vs/debugging/configuring-xdebug]

Xdebug 2

[XDEBUG]

xdebug.remote_enable = on

xdebug.remote_handler = dbgp

xdebug.remote_host = 127.0.0.1

xdebug.remote_port = 9000

xdebug.remote_mode = req

xdebug.idekey="php-vs"

Xdebug 2

[XDEBUG]

xdebug.mode=debug

xdebug.client_host = 127.0.0.1

xdebug.client_port = 9000

xdebug.start_with_request=trigger

  1. Serve lument project again php -S localhost:8000 -t public
  2. Finally Start the debug in VS Code and check breaking points
Related