您的位置:首页 > 编程语言 > PHP开发

用xdebug对php进行性能分析

2016-06-11 14:41 309 查看
1. 下载PHP的XDebug扩展,网址:http://xdebug.org/

2. 将下载的模块(php_xdebug-2.0.5-5.2.dll)放到PHP的安装的 ext 目录下;

3. 配置php.ini文件,将以下几行添加

extension=php_xdebug-2.0.5-5.2.dll
[Xdebug]

xdebug.auto_trace = 1

xdebug.collect_params = 1

xdebug.collect_return = 1

xdebug.profiler_append = 0xdebug.profiler_enable=1

xdebug.profiler_enable_trigger = 1#需要分析的时候,加XDEBUG_PROFILE参数

xdebug.profiler_output_name = "cachegrind.out.%p"#格式一定要对

 

xdebug.profiler_output_dir = "E:/Projects/xdebug"

4. 重启Apache服务器。

5. <?php echo phpinfo();?>如果输出的内容中有看到xdebug,说明安装配置成功。

6. 在Windows平台下,可以用客户端(Windows):WinCacheGrind WinCacheGrind 这个软件来打开这些文件。可以更直观地显示其中内容:
下载地址:http://sourceforge.net/projects/wincachegrind/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: