Xhprof在windows下点击[View Full Callgraph]调用graphviz软件时。
警告Warning: proc_open() [function.proc-open]: CreateProcess failed, error code – 0 in
并提示
failed to execute cmd " D:/graphviz-2.38/release/bin/dot -Tpng"

位置是xhprof_lib/utils/callgraph_utils.php文件下xhprof_generate_image_by_dot函数
windows下
$cmd = " dot -T".$type;
需要替换成
$cmd = " D:/graphviz-2.38/release/bin/dot -T".$type;

问题就出现在这行代码
$process = proc_open($cmd, $descriptorspec, $pipes, "/tmp", array());
需要改成
$process = proc_open($cmd, $descriptorspec, $pipes);

或者是建立相应的tmp文件夹,因为默认是不存在tmp文件夹的。尝试在网站根目录建立tmp文件夹但是还是保存,于是改成了在当前目录。
$process = proc_open($cmd, $descriptorspec, $pipes, "tmp", array());

//修改后的正确代码

  1. function xhprof_generate_image_by_dot($dot_script, $type) {
  2. //echo($dot_script);
  3. $descriptorspec = array(
  4. // stdin is a pipe that the child will read from
  5. 0 => array("pipe", "r"),
  6. // stdout is a pipe that the child will write to
  7. 1 => array("pipe", "w"),
  8. // stderr is a pipe that the child will write to
  9. 2 => array("pipe", "w")
  10. );
  11.  
  12. //$cmd = " dot -T".$type; //linux下
  13. //1.修改graphviz目录
  14. $cmd = " D:/graphviz-2.38/release/bin/dot -T".$type;//windows下
  15. //2.tmp文件夹处理
  16. $process = proc_open($cmd, $descriptorspec, $pipes);
  17. if (is_resource($process)) {
  18. fwrite($pipes[0], $dot_script);
  19. fclose($pipes[0]);
  20.  
  21. $output = stream_get_contents($pipes[1]);
  22.  
  23. $err = stream_get_contents($pipes[2]);
  24. if (!empty($err)) {
  25. print "failed to execute cmd: \"$cmd\". stderr: `$err'\n";
  26. exit;
  27. }
  28.  
  29. fclose($pipes[2]);
  30. fclose($pipes[1]);
  31. proc_close($process);
  32. return $output;
  33. }
  34. print "failed to execute cmd \"$cmd\"";
  35. exit();

  

}

Xhprof graphviz Warning: proc_open() [function.proc-open]: CreateProcess failed, error code 解决方法的更多相关文章

  1. PHP错误Warning: Cannot modify header information - headers already sent by解决方法

    这篇文章主要介绍了PHP错误Warning: Cannot modify header information - headers already sent by解决方法,需要的朋友可以参考下 今天在 ...

  2. PHP出现Warning: A non-numeric value encountered问题的原因及解决方法

    本文介绍php出现Warning: A non-numeric value encountered问题,用实例分析出现这种错误的原因,并提供避免及解决问题的方法. <?php error_rep ...

  3. Vue+DataTables warning:table id=xxxx -Cannot reinitialize DataTable.报错解决方法

    问题描述: 使用DataTables来写列表,用vue来渲染数据,有搜索功能,每次点击搜索就会报错,如下图所示. 问题排查: 找了一系列原因,最后发现是我每次请求完数据之后都会添加分页功能,从而导致了 ...

  4. php 出现Warning: A non-numeric value encountered问题的原因及解决方法

    在使用(+ - * / ** % << >> | & ^) 运算时,例如a+b,如果a是开始一个数字值,但包含非数字字符(123a),b不是数字值开始时(b456),就 ...

  5. PHP - xhprof+Graphviz 安装配置

    简介:XHProf是Facebook放出的轻量级调试工具.和Xdebug相比,XHProf更加易用和可控,尤其是生成流程图和调试数据对比的功能很好很强大. 参考:http://us2.php.net/ ...

  6. PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone

    在用PHP5.3以上的PHP版本时,只要是涉及时间的会报一个 Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the ...

  7. IAR for msp430 MDK中 warning: #223-D: function "xxx" declared implicitly 解决方法

    今天在EINT的范例里添加了一个函数,即eint.c中添加了一个datawrite()的函数,并在主函数main.c中调用,编译便警告 warning: #223-D: function " ...

  8. Warning: session_start() [function.session-start]: Cannot send session cookie解决办法

    在很多时间使用了session就会出来如下提示了, Warning: session_start() [function.session-start]: Cannot send session coo ...

  9. Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by

    配置php网站的时候,经常会在页首出现Warning: session_start() [function.session-start]: Cannot send session cache limi ...

随机推荐

  1. JS canvas 画板 撤销

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  2. build.gradle文件的注释

    Gradle是一种依赖管理工具,基于Froovy语言,面向Java应用为主,它抛弃了基于xml的各种繁琐配置,取而代之的是一种基于Groovy的内部领域特定(DSL)语言. apply plugin: ...

  3. Warning: imagettfbbox(): Could not read font in XXX on line X

    今天在做图形验证码的时候,在windows运行好好的代码在CentOS下却无法运行了.报了如下警告 Warning: imagettfbbox(): Could not read font in /m ...

  4. Shell中for循环的几个常用写法

    第一类:数字性循环-----------------------------for1-1.sh #!/bin/bash ;i<=;i++)); do echo $(expr $i \* + ); ...

  5. 关于PHP中拿到MySQL中数据中的中文在网页上显示为?的解决办法!

    问题: 解决方案: 在PHP 代码中 输入 : //$connection 是链接数据库返回的变量名: mysqli_set_charset($connection,'utf8'); 完美解决:

  6. SQLServer脚本编写

    临时接到通知,需要临时编写一个SQL Server的脚本,供出差的同事使用一下. 我当时心想这个SQL Server脚本听都没听说过,但是组织说决定就是你了,那我就只能硬着头皮上了. 脚本实现的功能比 ...

  7. leetcode69 X的平方根的几种解法

    第一种自然就是调APi啦(手动滑稽) public int mySqrt(int x) { return (int)Math.sqrt(x); } 时间是52 ms,还超过了1/5的人呢 第二种 二分 ...

  8. Docker 镜像、容器、仓库的概念及基本操作

    Docker 包括三个基本概念: 镜像(Image)容器(Container)仓库(Repository) 这三部分组成了Docker的整个生命周期,如下图所示,容器是由镜像实例化而来的,这和我们学习 ...

  9. 我可能不懂Array.prototype.sort

    今天 fix 我们后台系统的一些 bug.系统是基于 beego 和模板开发的,各种前后端代码揉作一团,没有格式,没有 eslint,全局变量满天飞,连 js 代码都有后端的插值,读起来非常 酸爽. ...

  10. MMORPG战斗系统随笔(一)、战斗系统流程简介

    前言 转载请标明出处http://www.cnblogs.com/zblade/ 很久没有更新博客,中间迁移过一次博客,后来一直忙于项目的开发,忙的晚上回去没时间写博客,周日又要自我调整一下,所以空闲 ...