phacility / xhprof

XHProf is a function-level hierarchical profiler for PHP and has a simple HTML based user interface.
http://pecl.php.net/package/xhprof
Apache License 2.0
2.6k stars 925 forks source link

Tweaked proc_open() call for callgraph to work on Windows #24

Closed Rarst closed 10 years ago

Rarst commented 11 years ago

Not tested on Linux, just got it working on Windows with some trial and error.

  1. Replaced hardcoded /tmp with sys_get_temp_dir(), there is some usual lively discussion in PHP docs, might or might not be reliable func to use.
  2. Passing empty array() for environment argument is different from default null and makes it fail to recognize dot command on Windows. I am not sure if passing it served some purpose or just unnecessary leftover.
billf commented 10 years ago

i'd like to understand what env variables Windows + dot need to be forwarded rather than being less restrictive with security (for everyone...) and forwarding everything.

also, so we may take your code contributions, please sign the contributor agreement at https://code.facebook.com/cla

Rarst commented 10 years ago

i'd like to understand what env variables Windows + dot need to be forwarded

This is (not too helpful) error I am getting verbatim, when emptying the passed context:

failed to execute cmd: " dot -Tpng". stderr: `"dot" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.
'

From some tinkering it seems providing PATH is sufficient, not sure however how it works for Linux side:

$process = proc_open( $cmd, $descriptorspec, $pipes, sys_get_temp_dir(), array( 'PATH' => getenv( 'PATH' ) ) );

please sign the contributor agreement

Done.

billf commented 10 years ago

ok, the current value is no env vars and i don't see any harm in propagating PATH to dot.

please update your pull request to include PATH and i'll merge it.

billf commented 10 years ago

thank you for your contribution