解析phpstorm + xdebug 远程断点调试

  XDEBUG配置:

  1.安装 xdebug 略了。网上有很多资料。

  重点写php.ini的配置

  [XDebug]

  

复制代码 代码如下:

  zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"

  xdebug.default_enable = On

  xdebug.collect_params = On

  xdebug.remote_connect_back = On           //如果开启此,将忽略下面的 xdebug.remote_host 的参数。 <一台webserver有多个开发者的工作目录的时候使用,如:p1.xx.com,p2.xx.com,p3.xx.com 。。。等。 >

  xdebug.remote_host = 192.168.59.104    //注意这里是,客户端的ip<即IDE的机器的ip,不是你的web server>

  xdebug.remote_port = 9900                       //      注意这里是,客户端的端口<即IDE的机器的ip,不是你的web server>

  xdebug.remote_enable = On

  xdebug.remote_handler = dbgp

  xdebug.remote_log = "/var/www/xdebug/xdebug.log"

  xdebug.remote_req = req

  xdebug.auto_trace = Off

  xdebug.remote_autostart = On

  xdebug.show_exception_trace = 0

  xdebug.collect_vars = On

  xdebug.collect_return = On

  xdebug.collect_params = On

  xdebug.var_display_max_depth = 15

  xdebug.show_local_vars = 1

  xdebug.dump_undefined = 1

  xdebug.profiler_enable = 1

  xdebug.profiler_output_dir = /var/www/xdebug

  PHPSTORM 配置:

  1.file->setings->php|Debug右侧。xdebug的那一块。 设置Debug port:9900(这里设置 的是,xdebug 吐出的debug信息,通过本机的什么端口传输。)

  2.file->setings->php|Servers  右侧。  host: 你的web服务器的域名或ip ,端口,  下面的 use path mapping  意的是,你的项目的目录,对应服务器上的,什么目录?   这里一定要设置哦! 不然,会发生找不到文件而出错,导至调试终止。

  3.Run->Edit Configurations-> 增加一个 PHP WEB APPlication 的调试点。  右侧: server 选择你上面建立的server.  starturl 设置你的入口文件。

  至此,配置完毕!

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

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

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