title: php exec() not working with SOME of the windows environment variables
body: <p>I am trying to run a couple commands from PHP with <strong>exec()</strong> and it seems to work only for some of the commands defined in my windows environment variables but not for all. <br />
  In my command prompt I can run all of this commands succesfully from any path (C:\ or E:\whatever) <br /></p>
  
  <pre><code>&gt; pear -V     // ... "PEAR Version: 1.9.5" ...
  &gt; dot -V      // dot - graphviz version 2.38.0 (20140413.2041)
  &gt; phpdoc -V   // phpDocumentor version 2.8.1
  </code></pre>
  
  <p>All of them return the correct version for each of the specified programs, that means that the environment variables are well configured. <br />
  But in PHP I can only run some commands, the rest of them fails:</p>
  
  <pre><code>$out = array();
  $ret = '';
  
  exec('pear -V', $out, $ret);
  echo var_dump($out); // $ret = 0, $out = array ..."PEAR Version: 1.9.5" ...
  
  exec('phpdoc -V', $out, $ret);
  echo var_dump($out); // $ret = 1, $out = array ..."Could not open input file: \phpdoc" ...
  
  exec('dot -V', $out, $ret);
  echo var_dump($out); // $ret = 1, $out = empty array
  </code></pre>
  
  <p>So, am I missing something?.</p>
  
  <p>EDIT: exec() is working fine, it works for some of my environment variables like pear, cmd, among others, it does not work for the specified above</p>
  
  <blockquote>
    <p>phpdoc <br />
    dot (GraphViz) <br /></p>
  </blockquote>
  
  <p>Even though they work on my command prompt and are well configured in my windows environment.</p>
  
  <p>EDIT2: <br />
  @Stefan Cvetkovic
  I gues this is the part that you want to see from the result when running this command </p>
  
  <blockquote>
    <p>shell_exec("set"): <br /></p>
    
    <p>Path=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Universal Extractor;C:\Program Files (x86)\Universal Extractor\bin;C:\xampp\php; PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC</p>
  </blockquote>
  
  <p>Is it possible that php has no access to my "dot" path, because this is missing from that result:</p>
  
  <pre><code>...C:\xampp\php;C:\xampp\php\pear\phpDocumentor\vendor\graphviz\bin
  </code></pre>
  
  <p>dot.exe is located in C:\xampp\php\pear\phpDocumentor\vendor\graphviz\bin and it is well configured as I can run <code>&gt; dot -V</code> from my command prompt.
  I have also tried changing its position in the PATH variable without luck.</p>