1. 官网下载xdebug,先择和php版本对就的xdebug
2.拷xdebug.dll到php/ext/目录下
3.打开php.ini在最后加入以下内容
[Xdebug]
zend_extension="C:/Program Files/PHP/ext/php_xdebug-2.1.0-5.3-vc6.dll"
xdebug.profiler_enable=on
xdebug.trace_output_dir="D:/debugerinfo"
xdebug.profiler_output_dir="D:/debugerinfo"
xdebug.auto_trace=on
xdebug.collect_params=on
xdebug.collect_return=on
xdebug.show_exception_trace = On
xdebug.remote_autostart = On
xdebug.remote_enable = On
xdebug.collect_vars = On
xdebug.remote_port = 9000
重启下apache,phpinfo()查看debug是否安装成功
4.zendstudio->windows->preperences->php->debug:选择xdebug,默认端口为9000,可以点击右边的configure配置端口,修改的端口要和php.ini 里的xdebug.remote_port = ***保持一致
到此配置完成
debug下默认:
WinCacheGrind是windows下的profile查看程序。所谓profile,就是程序或软件保存的档案资料,这里的profile就是xdebug生成的Log文件。
WinCacheGrind 下载地址:http://sourceforge.net/projects/wincachegrind
安装WinCacheGrind:安装WinCacheGrind 就像在Windows中安装其他软件一样。
配置WinCacheGrind: 打开WinCacheGrind,将"Tools"=>"Options" =>"Main"的"working flolder" 设置为php.ini中指定的路径xdebug目录。
现在就可以开始监测PHP代码了。
注意:
1,在 PHP5.3 里,zend_extension 不能写为 zend_extension_ts,这在 Xdebug 的官网里写的很清楚,虽然是洋文,我注意到了,没掉到陷阱里。也许 5.3 以后的版本,永远就是这样了。
2,xdebug.trace_output_dir 和 xdebug.profiler_output_dir 文件夹组要自己建立,用于存放 Xdebug 生成的文档。