PHPStorm使用Xdebug断点调试,从下班弄到深夜,期间踩遍了各种深的浅的,方的圆的各种坑,可算是搞定了。
这里写个笔记,提醒自己,也顺便当个指路明灯。
开发环境 Win10 + PHPStorm
运行环境 VMware + CentOS7
xdebug下载 https://xdebug.org/
安装和通常的php扩展一样,不清楚的参考README
在安装后再php.ini中添加以下配置项
[xdebug]
zend_extension=xdebug.so
xdebug.remote_enable=1
;xdebug.remote_connect_back = 1
xdebug.remote_handle="dbgp"
xdebug.remote_mode="req"
xdebug.remote_host=192.168.0.102
xdebug.remote_port=6053
xdebug.auto_trace=1
xdebug.collect_includes = 1
xdebug.collect_params = 1
;xdebug.collect_return = 1
xdebug.remote_autostart = 1
xdebug.idekey="PHPSTORM"
xdebug.remote_log = /tmp/xdebug.log
PHPStorm配置很多文章都有描述,这里不再记录,参考链接
需要注意的是,这里我使用的端口号是自己定义的6053,当然这里你也可以自己随便写,只要是未被占用就行。