背景描述
XHProf是一个轻量级的PHP性能分析工具.
使用XHProf的时候,在点击[View Full Callgraph]查看结果分析图时,会报错, 原因是缺少graphviz绘图软件。
在使用 brew安装graphviz软件出现了一些错误,特此记录一下.
具体内容
首先使用brew搜索是否存在graphviz软件,报错:
$ brew search graphviz
Error: GitHub {
"message": "Bad credentials",
"documentation_url": "https://developer.github.com/v3"
}
The GitHub credentials in the OS X keychain may be invalid.
Clear them with:
printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
Or create a personal access token:
https://github.com/settings/tokens/new?scopes=&description=Homebrew
and then set the token as:
export HOMEBREW_GITHUB_API_TOKEN="your_new_token"
这个错误描述的很清楚,系统钥匙串中的GitHub证书可能已失效。 解决办法也有了: (1) 清除 (2)或者重新生成一个TOKEN
按照第一种方式,报错:
$ printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
$ brew search graphviz
Error: GitHub API Error: API rate limit exceeded for 116.236.188.123.
(But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
Try again in 48 minutes 33 seconds, or create a personal access token:
https://github.com/settings/tokens/new?scopes=&description=Homebrew
and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token"
创建一个私人的访问TOKEN:
打开链接:
https://github.com/settings/tokens/new?scopes=&description=Homebrew
点击 "Generate token” 按钮,生成TOKEN, 比如本次生成的TOKEN: 00dc6141d83e69ec1fc3bwyt68cnwyt82eb063bd
在终端执行: export HOMEBREW_GITHUB_API_TOKEN=“your_new_token"
$ export HOMEBREW_GITHUB_API_TOKEN="00dc6141d83e69ec1fc3bwyt68cnwyt82eb063bd"
// 继续安装软件
$ brew search graphviz
$ brew install graphviz
graphviz安装成功。 在XHProf结果报告中点击[View Full Callgraph]也会生成图像。
扩展内容
XHProf是一个轻量级的PHP性能分析工具(层次式性能分析器,Hierarchical Profiler)。 Graphviz is open source graph visualization software。 Brew 又叫Homebrew, 是Mac OSX上的软件包管理工具。
参考链接
http://www.graphviz.org/ http://avnpc.com/pages/profiler-php-performance-online-by-xhprof http://www.cnblogs.com/phoenix-fec/p/5286695.html
[END]