Is there a way to check whether I should install the VC9 one or the VC6 one programatically?
It states on the left pane of the page you posted: Which version do I choose? If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP
If you are using PHP with IIS you should use the VC9 versions of PHP
VC6 Versions are compiled with the legacy Visual Studio 6 compiler
VC9 Versions are compiled with the Visual Studio 2008 compiler and have improvements in performance and stability. The VC9 versions require you to have the Microsoft 2008 C++ Runtime (x86) or the Microsoft 2008 C++ Runtime (x64) installed
Do NOT use VC9 version with apache.org binaries In you code you would test for apache or iis, if apache, then based on version.
in php use $_SERVER variables http://www.php.net/manual/en/reserved.variables.server.php
The files from apache.org are indeed compiled w/ VC6. However, the Apache files from apachelounge.com are compiled w/ VC9. If you use the apachelounge install, then use VC9 PHP.