您好,以下是您需要翻译的内容:
在 Docker 容器中,请不要使用 remote_host。此外,您无需在 Docker 或 Vagrant 中公开任何其他端口。
以下是适用于 PHP 5.6 的 xdebug.ini 文件。
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_connect_back=1
请确保 PhpStorm(2016.1 版本)已正确配置:
- Languages & Frameworks -> PHP -> Servers -> localhost -> localhost : 80 Xdebug
- Languages & Frameworks -> PHP -> Debug -> Xdebug -> Debug port: 9000
- Languages & Frameworks -> PHP -> Debug -> Xdebug -> Can accept external connections
- Languages & Frameworks -> PHP -> Debug -> DBGp Proxy -> Port 9000
完成以上步骤后,在 PhpStorm 工具栏中找到“Listen for debugger connections”图标并单击它。
如果要从命令行调用,请记得包含 XDEBUG_SESSION cookie。
curl 'http://localhost' -sSLI -H 'Cookie: XDEBUG_SESSION=xdebug'
如果您使用的是Firefox浏览器,请安装最简单的Xdebug插件,并在工具栏中启用。