【发布时间】:2021-07-09 19:48:07
【问题描述】:
我对 Linux 和 Docker 很陌生。 Sail 为我管理一切真是太好了!但我想允许在 VSCode 中进行调试。 我已经添加到我的 windows laravel 文件夹 /docker/8.0/php.ini
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host = host.docker.internal
xdebug.remote_port = 9001
我已经在我的 windows laravel 文件夹 /docker/8.0/Dockerfile 中添加了这个
ARG INSTALL_XDEBUG=true
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension
pecl install xdebug && \
docker-php-ext-enable xdebug \
;fi
# Copy xdebug configration for remote debugging
COPY .docker/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
EXPOSE 9001
我已经修改了我的 VScode launch.json :
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"pathMappings": {
"/": "${workspaceRoot}/"
},
"port": 9001
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9001
}
]
}
当我在 Ubuntu 中启动“起航”并在 VSCode 中启动调试器时,它不起作用:调试栏未激活(只有暂停、停止和重新启动按钮处于激活状态,所有其他按钮均未激活)
我该怎么办? 谢谢!
【问题讨论】:
-
有什么帮助吗?谢谢
标签: php laravel docker visual-studio-code dockerfile