Zend2(ZF2)的Debug及性能分析方法

来源:互联网 发布:sqlserver列明别名 编辑:程序博客网 时间:2024/06/05 18:55

Zend1.0时代有非常棒的工具ZFDebug,但在ZF2下显然还没有什么太好的方法。

这里推荐老办法,用Xdebug + 分析工具,勉强可以分析ZF2执行效率和引用文件。

在php.ini内如下设置

zend_extension = "D:\xampp\php\ext\php_xdebug.dll"xdebug.collect_includes = 1xdebug.profiler_enable = 0xdebug.profiler_enable_trigger = 1xdebug.profiler_output_dir = "D:\xampp\tmp"xdebug.profiler_output_name = "cachegrind.out.%u.log"

其中xdebug扩展的位置以及profiler的输出路径都需要根据实际情况调整。

配置完毕后重启Apache,在zf2项目URL中加入XDEBUG_PROFILE即可开启Xdebug Log输出,而平时则不会产生log。

http://localhost/?XDEBUG_PROFILE

输出log在windows下用WinCacheGrind,在Linux下用KCachegrind打开即可。也可以用PHP实现的项目Webgrind。Webgrind的作者也是ZFDebug的作者。

原文链接:Zend2(ZF2)的Debug及性能分析方法

0 0
原创粉丝点击