title: How to determine path to php.exe on Windows - search default paths
body: <p>I'm currently developing a couple of plugins for Sublime Text 2 on OS X and I would like to make them cross platform, meaning I have to find out if and where <code>php.exe</code> is installed.</p>
  <p>Right now I call <code>/usr/bin/php</code> in Python, which obviously works only on OS X and Linux:</p>
  <pre><code>phppath = '/usr/bin/php'&lt;br&gt;
  pluginpath = sublime.packages_path() + '/HtmlTidy/tidy.php'&lt;br&gt;
  retval = os.system( '%s &quot;%s&quot;' % ( phppath, scriptpath ) )
  </code></pre>
  <p>But on Windows, there seems to be no definitive default path for php.exe. The more I googled for it, the more possibilities showed up. So far I think I would have to check each of the following paths for existence:</p>
  <pre><code>c:\php\php.exe
  c:\php5\php.exe
  c:\windows\php.exe
  c:\program files\php\php.exe
  c:\wamp\bin\php\php5\php.exe
  c:\xampp\php\php.exe
  </code></pre>
  <p>That's already quite a collection, but what I'm asking for is either a <em>complete</em> list covering all possibilities - <em>or</em> another way to figure it out that should be as robust as checking each possible path.</p>
  <p>So if you have php.exe installed in some place other than these, please leave a comment with your path and I will add it to the list above.</p>
  <p>Besides, there seems to be <code>php.exe</code> and <code>php-cli.exe</code>. I guess it would be OK to loop through each possible path. Check first for php-cli.exe, check for php.exe, and take the first match. Is that correct or is there a better practice?</p>