网站性能-xdebug工具的使用

zend server ce自带的调试器调试功能比xdebug好用, 但可惜没有对profile的支持。

这种情况下可以发挥xdebug的长处。下面是简单的安装使用notes:

*) 安装zend server ce/apache2

*) 到xdebug网站下载dll文件如: php_xdebug-2.1.0-5.3-vc9-nts.dll

*) 获取安装指南: http://xdebug.org/find-binary.php

把phpinfo输出的html源码粘贴到上述页面中可得到类似如下的安装指南:

  1. Download php_xdebug-2.1.0-5.3-vc9-nts.dll
  2. Move the downloaded file to C:/Program Files/Zend/ZendServer/lib/phpext
  3. Open C:/Program Files/Zend/ZendServer/etc/cfg/debugger.ini and put a ; in front of the line that says zend_extension_manager.dir.debugger= so that it says ;zend_extension_manager.dir.debugger=
  4. Update C:/Program Files/Zend/ZendServer/etc/php.ini and change the line
    zend_extension = C:/Program Files/Zend/ZendServer/lib/phpext/php_xdebug-2.1.0-5.3-vc9-nts.dll
  5. 添加xdebug配置信息到php.ini中
  6. [xdebug]
    xdebug.profiler_output_dir="C:/Program Files/Zend/ZendServer/xdebug"
    xdebug.profiler_enable=1
    xdebug.profiler_enable_trigger=1
    xdebug.default_enable=On
    xdebug.show_exception_trace=On
    xdebug.show_local_vars=1
    xdebug.max_nesting_level=50
    xdebug.var_display_max_depth=6
    xdebug.dump_once=On
    xdebug.dump_globals=On
    xdebug.dump_undefined=On
    xdebug.dump.REQUEST=*
    xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT
    xdebug.trace_output_dir="C:/Program Files/Zend/ZendServer/xdebug"
    xdebug.remote_enable=1
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp
    xdebug.remote_log="C:/Program Files/Zend/ZendServer/xdebug/xdebug.log"
    xdebug.remote_autostart=1
  7. Restart the webserver

*) 安装WinCacheGrind, 这个是xdebug profile(性能日志)分析软件

*) 启动网站待调试页面后将在C:/Program Files/Zend/ZendServer/xdebug目录下生成cachegrind.out.*文件.

用wincachegrind打开可看到整个调用堆栈以及执行时间。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值