I've spent the last 10 hours working on a problem with apache virtual servers and php and after much frustration I've found the solution which would appear to be a bug.
The nutshell: if you have a virtual server installed with apache (at least the Win32 version of apache/php) you must comment out doc_root= in php.ini in order to get php files to work on the virtual servers.
Behavior if you don't do this:
It depends on variables that I've lost track of, but these were the problems I ran into:
php files will compile fine through the main server name but not the virtual host name. for example, let's say you have www.mysite.com pointing at /htdocs/ and test.mysite.com pointed at /htdocs/test/ and in that directory is a file called test.php. This means you can get to this file with both of the following urls:
test.mysite.com/test.php
www.mysite.com/test/test.php
If you follow the instructions with just about every php release that I could try, you are to go to php.ini and set doc_root= to:
doc_root=/htdocs/ (or doc_root=d:\htdocs\ or whatever). If you hit url number 2 above test.php will compile and work fine. If you try to open the same file using url number 1, you'll either get a Internal Servlet Error (500) or a 404 not found error. I think I also got a "No input file specified" error or something, too, but I can't remember now.
Additionally, if you look in your error log file for test.mysite.com (if you've specified apache to create one) you'll find something like:
Premature end of script headers: c:/php/php.exe
To my knowledge this is php telling you that it's too late for it to output an error because it's already sent the 500 headers to your browser. It can be caused by many things, but seems to most often be caused by not having your doc_root set to a directory that exists or otherwise is inaccessable (or doesn't match the apache document root, which is the case here).
So following the instructions, we set doc_root=c:\htdocs\ or whatever, then promptly hit test.mysite.com and now our doc_root is c:\htdocs\test (at least, this is how apache communicates it to php). So there's a mismatch and your phps don't work.
Solution: comment out doc_root entirely.
Dear god, that took me far to long to stumble upon. Pardon me if I'm wrong about anything above (I'm somewhat new to the php game being mired in jsp for the last several years). And please excuse my wordy description. I just couldn't find any info on this problem anywhere else and thought I'd share the knowledge.