Argghh! This has been a bit of a headache of mine now. Getting VirtualHosts in on Apache to work under Windows with PHP5

I read the Apache documentation over and over, and it appeared quite simple. Add a DNS entry to your local hosts file and update your http.conf file under Apache with the following code :


NameVirtualHost 127.0.0.1


<virtualhost 127.0.0.1>
DocumentRoot c:\apache\htdocs\satinsmooth
ServerName dev.mydomain.com
</virtualhost>

So I did, but whenever I tried to browse my virtualhost I got the following error "No Input File Specified" and a 404 error was recorded in the Apache access.log

So then I did the usual. Google'd for a while and came across some information about the way PHP and Apache handle errors so I added some syntax to my http.conf file as suggested

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^.+.php$ /404.html

and tried again. Now I got the official Apache 404 error detailing that it was unable to find the URL BUT it had pre-appended the location of my php.exe file to the URL. hummh!?

So then I Google'd some more, and find this tiny bit of information amongst a host of others. Remark the doc_root entry in your PHP.INI file. Ta Da ! It worked. Now I can happily add virtualhosts using the VirtualHost syntax above. Thank you phpfaqts