xdebug 的使用

xdebug 是一款很强大的php扩展,最大的用途就是对php代码进行调优


以下是xdebug的安装和使用方法


首先在这里下载xdebug扩展,如果不知道自己要下载哪个版本的话可以点击这里,输入你的phpinfo()输出,xdebug网站可以判断你需要的版本


然后再php.ini文件中加入一下代码,具体内容根据实际情况修改路径


zend_extension = E:\Windows7MasterSetup_1.80.exe\ext\php_xdebug-2.1.3-5.3-vc9-nts.dll

xdebug.remote_enable=on

xdebug.remote_handler=dbgp

xdebug.remote_host=localhost

xdebug.remote_port=9000

output buffer=off

xdebug.profiler_enable_trigger = 1


xdebug.profiler_enbale= 1


xdebug.profiler_output_dir=E:\wwwroot\webprofile


然后下载webgrind,这是一个能够帮助我们分析xdebug结果的web系统


它可以自动识别xdebugprofile的输出位置


当需要对网站进行调试的时候,可以在浏览器上访问,例如:www.test.asd/test.php?xdebug_profile


在url上添加xdebug_profile 就可以了


然后访问webgrind 看到你刚才访问自己的网站时,程序的执行情况