phpstorm + xdebug远程断点调试

  

Xdebug是一个开放源代码的PHP程序调试器(即一个调试工具),可以用来跟踪,调试和分析PHP程序的运行状况,本文主要记录一下在centos (linux)下Xdebug的安装和配置方法。

首先让PHP错误显示,只需要修改PHP。ini当中的2条指令,把displayerrors和htmlerrors都设置为,如下所示:

html_errors=,,
xdebug.profiler_enable=,,,
xdebug.trace_output_dir="/usr/地方/php5/xdebug/?,
xdebug.profiler_output_dir="/usr/地方/php5/xdebug/?,
xdebug.remote_enable=,,,,,,,,,,,,,
xdebug.remote_handler=dbgp ,,,,,,,,,,,
; xdebug.remote_host=localhost ,
xdebug.remote_port=9999,

重启php-fpm,可以通过phpinfo()检查你的xdebug是否安装成功,也可以随便写段错误的php代码,刷新浏览器,就能看到错误提示。

<人力资源/>

xdebug配置

1。在php。ini配置文件中添加如下内容
<代码> zend_extension="//你/把//xdebug的地方。所以“
2。如果是php5.3之前版本线程安全,添加如下内容代替上面1的内容
<代码> zend_extension_ts="/地方/你///xdebug。所以“
3。自从php5.3之后zend_extension_ts, zend_extension_debug不再使用

4。xdebug的一些其他配置

<>之前,显示错误信息   时间=xdebug.default_enable  1;函数调试   xdebug.auto_trace=对   xdebug.trace_output_dir   xdebug.trace_output_name   ,类型:字符串,Default 价值:trace. % c   时间=xdebug.collect_params  1 | 3 | 4,(参数长度,参数值,参数=值)   xdebug.show_mem_delta=1,显示内存   xdebug.collect_return=1,显示返回值   xdebug.trace_options =1,追加日志   时间=则=1 xdebug.collect_vars  1;开启性能分析   xdebug.profiler_enable=1;性能分析日志保存目录   xdebug.profiler_output_dir =,/数据/logs/xdebug/性,能分析日志文件名称   时间=xdebug.profiler_output_name  cachegrind.out.log;默认是如下格式,t时间,p进程id   xdebug.profiler_output_name =, cachegrind.out. % t % p      ;代码覆盖率   时间=xdebug.coverage_enable  1;以下是远程调试配置   时间=xdebug.remote_host=, 127.0.0.1xdebug.remote_connect_back  1 xdebug.remote_port  9000 xdebug.remote_log=,="/数据/日志/xdebug/xdebug。日志”

4。重启php使配置生效

<人力资源/>

性能分析日志工具

1。linux平台

工具KCacheGrind (linux, KDE), https://kcachegrind.github。io/

2。赢平台查看工具WinCacheGrind

相关网址

 http://ceefour.github.io/wincachegrind/https//sourceforge.net/projects/wincachegrind/https:/github.com/ceefour/wincachegrind/releases/tag/1.1 

列名称含义

自我显示在当前的代码块的执行时间

暨。:显示当前函数的函数的总exuction时间(自我)调用

Avg与总:平均每个电话的平均时间,总在所有调用花费的总时间。

3. web方式查看webgrind https://github.com/jokkedk/webgrind



1.文件→设置→php |调试右侧.xdebug的那一块。设置调试端口:9900(这里设置的是,xdebug吐出的调试信息,通过本机的什么端口传输。)

2.文件→设置→php | Servers 右侧又是;主持人:你的web服务器的域名或ip、端口,,下面的使用路径mapping 意的是,你的项目的目录,对应服务器上的,什么目录吗?,,这里一定要设置哦!不,然会发生找不到文件而出的错,导至调试终止。

3.运行→编辑配置→增加一个PHP WEB应用程序的调试点只右侧:服务器选择你上面建立的服务器只;starturl设置你的入口文件。

至此,配置完毕!

这样的请求,可以注册一个调试客户端哦!

http://www.aihuxi.com/* * * * . php ?XDEBUG_SESSION_START=19192

点击,小虫子图标,即可,开始调试!,

phpstorm + xdebug远程断点调试