1、xdebug扩展安装网上有很多类似的教程。我不会在这里详细描述它们。我主要贴出我的xdebug相关配置供大家参考:zend_debugger.allow_hosts=127.0.0.1zend_debugger.expose_remotely=alwayszend_debugger.httpd_uid=-1xdebug.trace_format=2xdebug。auto_trace=onxdebug.auto_profile=on;开启性能分析xdebug.collect_params=onxdebug.collect_return=onxdebug.profiler_enable=1xdebug.trace_output_dir=/tmpxdebug.profiler_output_dir=/tmp/xdebug;性能分析生成的文件目录xdebug.trace_output_%name=tracec.%pxdebug.show_exception_trace=On;打开异常跟踪xdebug.show_local_vars=0xdebug.profiler_output_name=cachegrind.out.%sxdebug.dump.GET=*xdebug.dump.POST=*xdebug.dump.COOKIE=*xdebug.dump.SESSION=*xdebug.var_display_max_data=4056xdebug.var_display_max_depth=5xdebug.remote_enable=onxdebug.remote_handler=dbgpxdebug.remote_host=127.0.0.1xdebug.remote_port=9010xdebug.remote_autostart=12、安装qcachegrind1时,在xdebug_outputir.profiler目录下生成性能分析文件/xdebug我配置分析程序性能。下图是我生成的性能分析文件。2、打开具体的性能文件单独查看,发现可读性很差。需要qcachegrin时d用这个工具打开生成的性能分析文件,可以很好的查看这个工具。直接打开性能分析文件效果:使用qcachegrind工具打开效果:3、现在安装这个工具(因为我用的是mac,所以这里是用mac的安装方法):(1)brewinstallgraphviz执行此命令安装graphviz,用于CallGraph功能(二)brewinstallqcachegrind安装qcachegrind(三)以上两步安装完成后,打开qcachegrind工具,发现无法使用CallGraph功能,【如何在MacOSXSnowLeopard上安装qcachegrind(kcachegrind)][4]这篇文章可以解决sudoln-s/usr/local/bin/dot/usr/bin/dot(4)我的mac执行了(3)中的命令错误:ln:/usr/bin/dot:OperationnotpermittedChecked接下来发现是mac系统的完整性保护。mac系统一些重要的系统目录禁止修改,即使切换到root。同时按住Command+R键(2)打开Terminal窗口,输入命令:csrutildisable;(3)重启电脑,然后执行命令:sudoln-s/usr/local/bin/dot/usr/bin/dot(4)重复步骤(1),将(2)中的命令替换为:csrutilenable;恢复默认的mac权限4.可以将自己安装的qcachegrind应用复制到APPlication目录下,随时打开查看
