在vscode中使用xdebug调试php代码

我使用的是lnmp环境,默认情况下9000端口被php-fpm占用,所以把xdebug监听的端口修改为9090,并把vscodelaunch.json里面的端口也对应修改为9090,即可!
php.inixdebug节下添加如下代码


[XDebug]

zend_extension = 'xdebug.so'

xdebug.remote_enable =1

xdebug.remote_autostart = 1

xdebug.remote_port = 9090

//launch.json


{

    // 使用 IntelliSense 了解相关属性。

    // 悬停以查看现有属性的描述。

    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

    "version": "0.2.0",

    "configurations": [

        {

            "name": "Listen for XDebug",

            "type": "php",

            "request": "launch",

            "port": 9090

        },

        {

            "name": "Launch currently open script",

            "type": "php",

            "request": "launch",

            "program": "${file}",

            "cwd": "${fileDirname}",

            "port": 9090

        }

    ]

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容