My friend does a lot of web development on her laptop. It is both her personal and work machine, so it needs to have a lot of stuff installed on it (a working install of xampp, multiple sites, video editing software and games). To help ease the pressure on the hardware, I suggested we install a virtual machine to run her web server services. That will allow her to easily change from work mode to play mode and ensure all hardware resources are available for video editing or gaming.
The plan was to use Windows Virtual PC to run a VM. All the files required would be housed on the host machine’s hard drive and somehow we would share that to the xampp htdocs folder allowing her to work on the host and have the guest machine publish the updates immediately.
First up we installed Windows Virtual PC and installed a Windows 7 32-bit OS on a guest. I personally run a Ubuntu VM for this purpose, but my friend is more familiar with Windows. We installed xampp on the guest.
Next I shared the htdocs stored on the host machine. Both the physical and virtual machine are in the same homegroup and have sharing permissions set up (we can trust our own VM almost explicitly).
On the guest:
net use Z: \\host\dev\htdocs password /user:HOST\username /persistent:yes
This mounts the network share as a user on the host machine. That takes care of some permissions issues I ran into and hope to solve when I have more time (my friend needed the machine up and running to do her job!).
Once the share was mounted as a network drive, it was time to tell Apache to use the files. Instead of configuring Apache to look at the Z: drive, I decided to use Windows 7′s mklink command to create a symbolic link:
mklink /D C:\xampp\htdocs Z:
The drive will remount on start up and the symbolic link will let Apache think it is looking at files directly in the htdocs folder. Now, when the website files are changed on the host one can simply load up a browser and navigate to http://guest and see the changes!
