With the WinPHP challenge in its second week I think all participants have created their PHP Dev/Test environment. Now @juokaz asked me how to deploy bits to a Windows Server 2008 machine.
To do this we’ll use the Web Deployment tool we’ll also use the IIS Managemt service to deploy to a remote service without RDP-ing into it.
First of all we of course need to install the Web Deployment tool. To do this we of course use the Web Platform Installer (WebPI).
On the dev and the production machine we install the Web Deployment Tool 1.0RC.
I’ve installed WordPress on my dev machine and will be deploying that as a sample to also show you can deploy MySQL Databases.
To deploy an MySQL database the web deployment tool needs a snapshot of your DB. To get this run the mysqldump command in the bin directory of your mysql install.
mysqldump –uusersname –ppassword database > filename.sql (replace bold stuff with
Now we can make the actual export. In the IIS manager we navigate to the application we want to deploy and we click on the export application button.
Now we get the create application package dialogue.
We click Add Component and in the Provider name we select dbMySQL path field we enter the exportfile we created with mysqldump. There are a whole lot of providers there is of course a provider for MSSql but also for GAC Assemblies, registry keys, application host config files and a lot more.
After that we click Ok and we click next until we have to give in a name of the export package. This is a zipfile.
Now move your package to your production server using your protocol of choice.
On the production server we open IIS manager and select the site where we want to import the application. And we select Import application.
Now we browse to the application package we just copied to the server.
The Web Deployment tool shows you what is in the package and you can change some parameters.
We must do that so we can specify a different username and DB name.
If you have configured all parameters and import the package you have deployed you application to the production server.
You can find all this information on the IIS site on http://www.iis.net/extensions/WebDeploymentTool.