Zend1.0时代有非常棒的工具ZFDebug,但在ZF2下显然还没有什么太好的方法。
这里推荐老办法,用Xdebug + 分析工具,勉强可以分析ZF2执行效率和引用文件。
在php.ini内如下设置
zend_extension =
"D:\xampp\php\ext\php_xdebug.dll"
xdebug
.collect_includes =
1
xdebug
.profiler_enable =
0
xdebug
.profiler_enable_trigger =
1
xdebug
.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:
输出log在windows下用WinCacheGrind,在Linux下用KCachegrind打开即可。也可以用PHP实现的项目Webgrind。Webgrind的作者也是ZFDebug的作者。
原文链接:Zend2(ZF2)的Debug及性能分析方法
转载请注明原文地址: https://ju.6miu.com/read-669834.html