您的位置:首页 > 运维架构 > 网站架构

网站性能-xdebug工具的使用

2011-03-07 15:10 197 查看
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源码粘贴到上述页面中可得到类似如下的安装指南:

Download php_xdebug-2.1.0-5.3-vc9-nts.dll

Move the downloaded file to C:/Program Files/Zend/ZendServer/lib/phpext

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=


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


添加xdebug配置信息到php.ini中

[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

Restart the webserver

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

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

用wincachegrind打开可看到整个调用堆栈以及执行时间。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: