I'd suggest to install PHP as apache module. Besides that think about installing xampp. This package comes with almost everything you need (incl. apache, mysql, php and much more).
The steps to install PHP as module (assuming that you want to install php 5.x to C:\PHP).
- copy at least php5ts.dll to the <apache>\bin directory
- depending on the PHP extensions you want to enable you might need to copy some of the other dlls from C:\PHP to the <apache>\bin directory. There's a text file in the PHP directory that contains a list of the extensions and depending dlls.
- copy php.ini to <apache>\bin and make sure to set at least the extension_dir variable in php.ini (C:\php\ext)
- Edit httpd.conf and remove all the lines you added to enable php.
- Then add the following line to httpd.conf at the end of the LoadModule block:
LoadModule php5_module C:\PHP\php5apache2.dll
- Add the following line to httpd.conf:
AddType application/x-httpd-php .php
Then restart apache. Create a script in the document root directory that contains
<?PHP
phpinfo();
?>
and check if that script works.
About the virtual hosts. Modify the virtual host blocks so that the heads contain the ip address, like e.g.
NameVirtualHost 127.0.0.1:80
...
...
<VirtualHost 127.0.0.1:80>
ServerName www.mydomain1.com
DocumentRoot C:\sites\www.mydomain1.com\htdocs
....
</VirtualHost>
<VirtualHost 127.0.0.1:80>
ServerName www.mydomain2.com
DocumentRoot C:\sites\www.mydomain2.com\htdocs
....
</VirtualHost>
In order to test the virtual hosts modify the file <windows>\system32\drivers\etc\hosts and add (or modify) the following line:
127.0.0.1 www.mydomain1.com www.mydomain2.com
(just add the two strings to the 127.0.0.1 line if it already exists)
Then close and reopen the web browser and try to access the two different virtual hosts.
Thomas