phpstorm+xdebug调试php代码

2018-12-04  本文已影响0人  syca

调试Web应用

编辑php.ini文件

xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9001
xdebug.idekey=PHPSTORM

其他常见的配置项:

调试命令行脚本

export XDEBUG_CONFIG="idekey=PHPSTORM"

php -dxdebug.remote_enable=1 -dxdebug.remote_port=9001 -dxdebug.remote_host=172.16.120.160 -dxdebug.remote_connect_back=0  <your-script>

跟远程调试Web应用的配置差不多,只是一般你的php.ini会针对Web应用调试而配置,所以你需要在调试脚本的时候显式指定一些调试选项,特别是remote_host,因为脚本是在远程机器上执行的,不能像Web应用一样能够查询到发起请求的IP

相关链接

https://www.jetbrains.com/help/phpstorm/debugging-with-phpstorm-ultimate-guide.html
https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
https://xdebug.org/docs/all_settings
https://xdebug.org/docs/remote#starting
https://segmentfault.com/a/1190000011332021
https://segmentfault.com/a/1190000011387666

上一篇 下一篇

猜你喜欢

热点阅读