xdebug配置
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1 #啟用遠(yuǎn)程調(diào)試
xdebug.remote_autostart=1
xdebug.remote_port=9000 #端口
xdebug.remote_host=host.docker.internal #宿主機ip
remote_host是宿主機ip咱娶,因為是在宿主機下進(jìn)行代碼編寫, remote_port=9000可能與fpm端口沖突滩援,適當(dāng)更改即可
vscode中的配置
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/code/shopCrm": "/Volumes/work/shopCrm"
}
}
]
}
port是xdebug配置里面的remote_port
pathMappings里面栅隐, "/code/shopCrm"是容器里面代碼的路徑, "/Volumes/work/shopCrm"是宿主機里面代碼的路徑