linux dot 实用程序(使用 xhprof)

发布于 2024-09-04 02:21:14 字数 389 浏览 6 评论 0原文

我安装了 php 的 xhprof 分析扩展

一切都很好,除了 callgraph.php 文件,它返回: 无法 shell 执行 cmd=" dot -Tpng"

所以我检查了一下,发现 dot 实用程序没有安装,所以我安装了它。

它似乎从命令行运行良好,所以我再次运行脚本,同样的错误: 无法 shell 执行 cmd=" dot -Tpng"

xhprof 文档指出: callgraph 图像可视化([View Callgraph])功能依赖于路径中 Graphviz“点”实用程序的存在。

但我不明白我现在需要做什么,特别是“实用程序”你的道路”部分

任何帮助表示赞赏,谢谢大家

i installed the xhprof profiling extension for php

Everything is fine except for the callgraph.php file, it returns:
failed to shell execute cmd=" dot -Tpng"

so i checked and the dot utility wasn't installed, so i installed it.

it appears to be running fine from the command line so i ran the scritp again, same error:
failed to shell execute cmd=" dot -Tpng"

the xhprof documentation states:
the callgraph image visualization ([View Callgraph]) feature relies on the presence of Graphviz "dot" utility in your path.

but i don't understand what i need to do now, specifically the "utility in your path" part

Any help appreciated, thanks guys

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

漫雪独思 2024-09-11 02:21:14

如果您想要 xhprof 的图形功能,请在终端中运行下一个命令:

sudo apt-get install graphviz

If you want graphing functions for xhprof run next command in terminal:

sudo apt-get install graphviz
剩一世无双 2024-09-11 02:21:14

当我启用 error_reporting 时,我发现缺少一些配置变量:

function xhprof_generate_image_by_dot($dot_script, $type) {
  // get config => yep really dirty - but unobstrusive
  global $_xhprof;

  $errorFile    = $_xhprof['dot_errfile'];
  $tmpDirectory = $_xhprof['dot_tempdir'];
  $dotBinary    = $_xhprof['dot_binary'];

将以下行添加到 xhprof_lib/config.php 后,它可以工作

$_xhprof['dot_errfile'] = '/home/peniel/var/log/xhprof/error.log';
$_xhprof['dot_tempdir'] = '/home/peniel/var/log/xhprof';
$_xhprof['dot_binary'] = '/usr/bin/dot';

When I enable error_reporting, I see there are some configuration variable are missing:

function xhprof_generate_image_by_dot($dot_script, $type) {
  // get config => yep really dirty - but unobstrusive
  global $_xhprof;

  $errorFile    = $_xhprof['dot_errfile'];
  $tmpDirectory = $_xhprof['dot_tempdir'];
  $dotBinary    = $_xhprof['dot_binary'];

After add the following lines to xhprof_lib/config.php, it works

$_xhprof['dot_errfile'] = '/home/peniel/var/log/xhprof/error.log';
$_xhprof['dot_tempdir'] = '/home/peniel/var/log/xhprof';
$_xhprof['dot_binary'] = '/usr/bin/dot';
命比纸薄 2024-09-11 02:21:14

如果您安装了graphviz,由于安全限制,也会出现此错误。某些功能可能被禁用。因此,请查看您的日志以获取一些 php 警告。

例如:

PHP Warning:  proc_open() has been disabled for security reasons in /usr/share/php/xhprof_lib/utils/callgraph_utils.php on line 112

您需要配置php.inisecurity.ini参数“disable_functions”。

If you have installed graphviz this error also will occure because of the security restrictions. Some functions may be disabled. So, see your logs for some php warnings.

For example:

PHP Warning:  proc_open() has been disabled for security reasons in /usr/share/php/xhprof_lib/utils/callgraph_utils.php on line 112

You need to configure php.ini or security.ini parameter "disable_functions".

唱一曲作罢 2024-09-11 02:21:14

该实用程序“位于您的路径中”意味着可以通过环境变量 PATH 找到它。此环境变量包含 shell 在其中查找您在没有显式路径的情况下运行的二进制文件的目录。

假设 dot 的完整路径是 /opt/foo/bin/dot。然后你想这样修改你的 PATH 环境变量:

PATH=${PATH}:/opt/foo/bin

Having the utility "in your path" means that it can be located by the environment variable PATH. This environment variables contains directories where the shell looks for binaries that you run without an explicit path.

Let's say the full path to dot is /opt/foo/bin/dot. Then you want to modify your PATH environment variable this way:

PATH=${PATH}:/opt/foo/bin
辞旧 2024-09-11 02:21:14

就我而言,这只是因为未安装 graphviz 造成的。您可以在命令行上使用 which dotlocate graphviz 进行检查。

In my case this was caused simply because graphviz was not installed. You can check with which dot or locate graphviz on the command line.

旧夏天 2024-09-11 02:21:14

如果您有 Graphviz 但仍然收到错误,快速解决问题的步骤:

  1. 运行“which dot”

/usr/local/bin/dot

  1. 打开 xhprof_lib/utils/callgraph_utils.php 第 110 行将
  2. “dot”替换为“/usr/local/bin/dot”(或您拥有的路径)

steps for fast fix the issue if you have Graphviz and still getting error:

  1. run "which dot"

/usr/local/bin/dot

  1. open xhprof_lib/utils/callgraph_utils.php line 110
  2. replace "dot" by "/usr/local/bin/dot" (or path you have)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文