如何使用Xdebug单步调试PHP游戏服务器

参考文章:https://www.sourcetoad.com/resources/debugging-php-save-time-with-xdebugs-remote-autostart/

配置参数详解:https://xdebug.org/docs/remote

根据Xdebug的文档,触发Xdebug远程调试的方式有三种:

1. 在请求中传入XDEBUG_SESSION_START

2. 使用XDEBUG_SESSION的Cookie

3. 配置xdebug.remote_autostart为1

对于游戏来说,客户端不总是浏览器,每次像PHP服务器传参数或者Cookie是不现实的,所以前两种方法并不实用,但是第三种方法就很方便。

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart = 1
xdebug.idekey="PHPSTORM"

原文地址:https://www.cnblogs.com/lilei9110/p/7347133.html