Can't using Visual Code to debug in Laravel project

后端 未结 4 1940
你的背包
你的背包 2021-01-05 03:46

I was config success to debug in PHP on VSCode.

My problem is when I run the project it always errors at the function:

protected function getJsonPayl         


        
相关标签:
4条回答
  • 2021-01-05 04:16

    Had the same issue when using Docker with VsCode and xDebug in Laravel.

    For anyone interested in a different approach (since Laravel 5.6 there is no optimize command anymore)

    Just add the ignore section to your launch.json config.

    {
       "name": "Listen for XDebug",
       "type": "php",
       "request": "launch",
       "port": 9000,
       "pathMappings": {
           "/var/www/html": "${workspaceRoot}",
        },
        // add this
        "ignore": [
            "**/vendor/**/*.php"
        ]
    },
    

    Solved the issue for me.

    Got this from Docker Github Repo

    0 讨论(0)
  • 2021-01-05 04:23

    On Laravel 5.7, it works for me:

    {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "ignore": [
                "**/vendor/**/*.php"
            ]
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000,
            "runtimeExecutable": "/usr/bin/php"
        }
    ]
    }
    
    0 讨论(0)
  • 2021-01-05 04:29

    I had the same problem and the accepted answer solved it.

    However, if anyone simply wants to dismiss the problem temporarily, rather than getting to the root of it, you can uncheck the "Everything" checkbox at the bottom of the Breakpoints panel of the debug pane, and that will skip over the error.

    0 讨论(0)
  • 2021-01-05 04:40

    Your question seems to be a related post to this, which provides a pretty good answer. Also, my question to you is why are you using DecryptException? Laravel has bcrypt(for password hashing) and csrf tokens (form data encryption) that are much easier to use.

    For those looking for a quick answer without reading the comments:

    Run these commands in Eloquent:

    php artisan optimize -> php artisan cache:clear -> composer dump-autoload

    0 讨论(0)
提交回复
热议问题