很好用的php执行时间分析工具webgrind

xdebug

http://xdebug.org/

下载地址:

Source:

Windows modules:

windows

  1. 编辑php.ini,先注释掉zend:
    [Zend]
    ;zend_extension_ts = “D:\Xampp\php\zendOptimizer\lib\ZendExtensionManager.dll”
  2. 启用x-debug
    [xdebug]
    zend_extension_ts = “D:\Xampp\php\ext\php_xdebug-2.0.0-5.2.2.dll”;必须为完整路径
    xdebug.profiler_enable_trigger = 1
    xdebug.profiler_output_dir=”D:\Xampp\tmp\xdebug”

linux

  1. 安装xdebug扩展
    sudo pecl install xdebug
  2. 编辑php.ini,启用x-debug
    [xdebug]
    zend_extension_ts = “/usr/lib/php5/xdebug.so” ;必须为完整路径
    xdebug.profiler_enable_trigger = 1
    xdebug.profiler_output_dir=”/tmp”

webgrind

(http://code.google.com/p/webgrind/ )

下载地址:http://webgrind.googlecode.com/files/webgrind-release-0.81.zip

  1. 下载webgrind,解压缩到web目录
  2. 首先访问需要优化的php程序,get/post请求中加入XDEBUG_PROFILE
    例如info.php,http://localhost/info.php?XDEBUG_PROFILE
  3. 然后访问:http://localhost/webgrind/
    默认auto,即为刚刚请求的文件profile,[update]!
    程序不兼容IE(本机测试winxp+ie6),如果点了update之后毫无反应,请使用firefox。

转自 http://www.hemon.cn/blog/archives/97

原文地址:https://www.cnblogs.com/datang/p/2479876.html