Loading... # PHP XDebug Usage ## 1) Life time > 手动 or 自动开启 debug session ,终止于手动或程序自动退出. ## 2) How to start ### Setup Params * Add parameter into URL or form , eg. `XDEBUG_SESSION_START=sessName` * Setup session `XDEBUG_SESSION=sessName` ### Auto Start * `php.ini` additional config `xdebug.remote_autostart=1` ## 3) Connect with IDE ### a) Auto connect client (single machine) > a) `$_SERVER HTTP_X_FORWARDED_FOR` &`REMOTE_ADDR or REMOTE_ADDR` to get the request IP > b) IDE exposes TCP port > c) server IP could ping successfully ### b) Setup client IP (Docker/VM) ``` # xdebug 3.x [xdebug] xdebug.mode = develop,debug # replace the xdebug2 xdebug.remote_enable xdebug.client_host = host.docker.internal # IDE machine ip xdebug.client_port = 9003 # IDE debug extension TCP port xdebug.start_with_request = yes # replace the xdebug2 xdebug.remote_autostart xdebug.idekey = "PHPSTORM" xdebug.remote_log = /var/log/xdebug.log ``` ## Failure 1. `curl -v telnet://192.168.33.1:9003`  2. Encounter error `the input device is not a TTY` . Please add the environment variables value: `COMPOSE_INTERACTIVE_NO_CLI=1` Last modification:June 3, 2023 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 0 If you think my article is useful to you, please feel free to appreciate