Synchronizing Two IIS Servers with PHP
By Tim Ammann
March 26, 2010
This article will guide you through the process of using Web Deploy to synchronize an entire IIS 7 or above Web server that has PHP installed to another IIS 7 or above server.
Article Goal: To synchronize a Web server from IIS that has PHP installed to another IIS server.Part 1 - View dependencies of the source
1. Get the dependencies of the Web site by running the following command:msdeploy -verb:getDependencies -source:webServer
2. Review the output of the dependencies and look for any script maps or installed components that are in use by the site.
Note: In most cases on Windows Server 2008, PHP is installed by using the built-in FastCGI module, so the dependency check will show CGI as a dependency, not PHP.3. Compile a list of the components needed on the destination.
Part 2 - Configure the target or destination computer
1. Review the list of dependencies and install them on the destination server.Part 3 – Create a custom manifest
Create the following manifest, assuming that your PHP install location is c:\php (replace with your actual install directory):Part 4 – Synchronize the source server to the destination server
Synchronize by using a package file:
1. Always make a backup of the destination server. Even if you are just testing, it allows you to easily restore the state of your server. Run the following command to backup an IIS server:2. Run the following command on the source server to create a package (compressed file) of the server:%windir%\system32\inetsrv\appcmd add backup “PreMsDeploy”
3. Run the following command on the destination server to validate what would happen if a synchronization were run:msdeploy -verb:sync -source:manifest=servermanifest.xml -dest:package=c:\WebServer.zip
4. After verifying the output, run the same command again without the -whatif flag:msdeploy -verb:sync -source:package=c:\WebServer.zip -dest:manifest=servermanifest.xml -whatif > msdeploysync.log
msdeploy -verb:sync -source:package=c:\WebServer.zip -dest:manifest=servermanifest.xml > msdeploysync.log
Synchronize by using the remote service:
If you don't want to synchronize from a package, you can synchronize by using the Web Deployment Agent Service (MsDepSvc, also called the "remote service"). Make sure that the service is started on the destination computer by running the command:2. Run the following command on the source server. Use the computerName argument to specify the name of a remote server (for example, DestServer1). If the source is a remote server, you would change the source argument to source:manifest=servermanifest.xml,computerName=Server1.net start msdepsvc
3. After verifying the output, run the same command again without the whatif flag:msdeploy -verb:sync -source:manifest=servermanifest.xml -dest:manifest=servermanifest.xml,computerName=DestServer1 –whatif > msdeploysync.log
msdeploy -verb:sync -source:manifest=servermanifest.xml -dest:manifest=servermanifest.xml,computerName=DestServer1 >msdeploysync.log
Summary
You are now done synchronizing your site. To verify, test browsing to the Web site on the destination server. For troubleshooting help, see Troubleshooting Web Deploy.Discuss in IIS Forums