PHP的profile分析工具xhprof的安装

xhprof 是Facebook开源的一个性能分析工具, 功能比xdebug强大, 但是消耗资源比xdebug少的多。 安装 xhprof 步骤一: 下载并安装 wget http://pecl.php.net/get/xhprof-0.9.2.tgz tar zxf xhprof-0.9.2.tgz cd xhprof-0.9.2 /usr/local/php/bin/phpize ./configure –with-php-config=/usr/local/webserver/php/bin/php-config make make install 安装 xhprof 步骤二: 配置PHP.ini 在你的php.ini的最后加上 [xhprof] extension=xhprof.so xhprof.output_dir=/tmp/xhprof 然后重启php / php-fpm 安装 xhprof 步骤三: 开始使用xhprof 把xprof安装包里边的两个目录拷贝到你的项目目录下,然后新建一个测试的文件: save_run($xhprof_data, “xhprof_foo”); echo ” ” , “Graphics below: “; echo “http://10.241.38.44/xhprof_html/index.php?run=$run_id&source=xhprof_foo “; 当然这个界面还很丑,反映出来的信息也不多,想要更强大的图形界面工具, 还需要安装Graphviz, 这个以后会讲, 欢迎继续关注我的博客。

posted on 2011-03-10 11:42  Megratron  阅读(608)  评论(0编辑  收藏  举报

导航