【发布时间】:2019-07-19 22:57:26
【问题描述】:
我在使用 VSCode 调试 PHP 时遇到问题。
Dockerfile 暴露端口 80
我要调试的页面真的很简单:
home.php
<?php
$name = 'AAA';
echo $name; <--- here is the breakpoint
php.ini
xdebug.default_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_port = 80
xdebug.idekey = VSCODE
launch.json(XDebug 配置)
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
}
]
}
调试控制台没有显示任何错误,但是一旦我加载主页,它就不会在断点处停止。
【问题讨论】:
-
"Dockerfile EXPOSE 端口 80" 那又怎样? Xdebug 根本不关心网站端口。 "xdebug.remote_port = 80" 为什么是 80?请先检查 Xdebug 的工作原理以及该值的用途。 xdebug.org/docs/remote#communication
标签: php debugging visual-studio-code docker-compose xdebug