参考文档:
https://zhuanlan.zhihu.com/p/113171737
安装vscode、下载phpstudy最新版这2步都不说了,网上大把教程。本文主要把phpstudy的一个坑点记录一下
配置网站
配置伪静态
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
try_files $uri $uri/ =404;
}1
开启phpxdebug
配置php设置xdebug
vscode安装插件
vscode 配置 launch.json
{
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"stopOnEntry": true,
"port": 9002
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9002,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
}
]
}
装完插件,然后配置插件:File--Preferences--Settings--Extensions--PHP:
写入你要用的php版本所在位置:
"php.validate.executablePath": "D:\\phpstudypro\\Extensions\\php\\php7.1.9nts\\php.exe"
配置php.init
[Xdebug]
zend_extension="D:\phpstudypro\Extensions\php\php7.1.9nts\ext\php_xdebug.dll"
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=On
xdebug.trace_output_dir="D:\phpstudypro\Extensions\php_log\php7.1.9nts.xdebug.trace"
xdebug.profiler_enable=On
xdebug.profiler_output_dir="D:\phpstudypro\Extensions\tmp\xdebug"
xdebug.remote_enable=On
xdebug.remote_autostart = On
xdebug.remote_host=localhost
xdebug.remote_port=9002
xdebug.remote_handler=dbgp
xdebug.remote_autostart = 1
xdebug.remote_log = D:/phpstudypro/Extensions/tmp/xdebug/log/php/xdebug2.log
标签:坑记,xdebug,remote,phpstudypro,Extensions,php,断点,port
From: https://www.cnblogs.com/haima/p/18493695