PHP调试:PHPStream + XDebug
第一步:安装xDebug扩展
1. 先判断自己要下载什么版本的扩展(很重要):控制台输入php -i,将输出的内容复制到https://xdebug.org/wizard
2. 点击按钮,就能得到下载路径。
3. 在php.ini中配置xDebug:
[xdebug]
;断点调试
xdebug.remote_enable=on ;远程调试
xdebug.remote_autostart=on ;开启远程调试自动启动
xdebug.remote_host=192.168.33.1
xdebug.remote_port=9001
xdebug.auto_trace=on ;启用代码自动跟踪
xdebug.collect_vars=on ;收集变量
xdebug.collect_return=on ;收集返回值
xdebug.collect_params=on ;收集参数
xdebug.idekey=hanpy
xdebug.remote_log="日志地址"
;性能分析
xdebug.profiler_enable=On ;启用性能检测分析
;xdebug.trace_output_dir="/tmp/xdebug_profiler" ;指定堆栈跟踪文件的存放目录
xdebug.profiler_output_dir="/tmp/xdebug_profiler" ;指定性能分析文件的存放目录
xdebug.profiler_output_name="cachegrind.out.%p"
xdebug.profiler_enable_trigger=1
4. 验证xDebug扩展是否安装成功:
phpinfo();输出的信息是否有以下信息,
如果有则证明成功了。进行下一步骤。
第二步:phpstream配置调试:
1. 端口与php.ini中配置的xdebug.remote_port一样。
2.
3.
4.
5.
6.
7.
至此,浏览器会打开一个地址,该地址就是访问项目的默认地址。如: