Creating your PHP dev environment for the WinPHP Challenge
For those of participants in the WinPHP challenge that are looking at Windows Server 2008 for the first time and haven’t looked at Windows for I write this article to make a flying start coding.
The Server that Leaseweb has sponsored are running Windows Server 2008 web edition and need to be configured from scratch. To have an test / dev environment you are able to run either Windows Vista SP1 (as it has the same version of IIS7 build in).
If you are however not running Windows Vista but are running Windows XP or Windows Server 2003 on your dev machine you can use Virtual PC to create a VPC with Windows Server 2008. You can download Virtual PC from here.
If you are running OSX as your main OS there are solutions from VMWare, Parallels and probably others to create virtual machines on a Mac if you are running Linux on your dev/test machine you will probably go with Xen - UPDATE - @stuherbert pointed out that Virtualbox would be the VM technology of choice for the linuxdevs out there.
Anyway in this post I’ll show how to run with VirtualPC as “I’m a PC and running Windows (7)”
Once you have installed VirtualPC you will be asked to create a new VirtualPC. Everything is pretty self explanatory. When I create a VPC I always move the files out of the default location or it will store the VPCs in your documents folder. Next to that the only thing I change is that I increase the memory for the machine to 1024MB (I have 4GB in my dev machine) and that normally works ok.
Now we need the bits. You can download any version of Windows Server 2008 from here for a 60 day evaluation trial and if you register you can extend it to 240 days. The participants of the WinPHP Challenge will recieve a copy of the Windows Web Server 2008 software so lets run with that this is the direct link to the Windows Web Server 2008 edition.
So now I have a virtual machine which settings look something like this.
I’ve downloaded the ISO for Windows Server 2008 web edition which I mount to the Virtual Machine and then I boot. To do that start the VPC and right click on the CD icon in the bottom of the VPC screen.
Installing windows is pretty straight forward. With Windows Server 2008 you just select all default options and you have a running machine in Virtual PC. All roles will be configured after installation.
After Windows Started for the first time you get the Initial Configuration Tasks.
The only thing I do here is enabling Remote desktop so I can use Terminal Services to connect to my dev/test server. This works smoother then the VPC client. The rest of the server we configure with the Web Platform Installer so we can click the “do not show this window at logon” checkbox.
After that you need to install the VM additions. This will give you a smoother ride in VPC. You install them by selecting Action – Install VM Additions
Ok so now we have a clean install of Windows Server 2008 with no roles at all. Let’s change it into a Web Server that can run PHP and has a Database installed.
Make sure your machine is connected to the internet and go to this URL. And select the Web Platform Installer 2 Beta.
The web platform installer (WebPI) will launch and allow you to select exactly how you would like to configure your webserver. It will download all required bits and install and configure them.
It also has the posibilities to install common web applications like Drupal, Wordpress, Gallery. We’ll be extending this list as we go along.
For now I only want PHP to run. We’ll talk a bit more about different IIS features in future posts.
If I press the install button the WebPI will add all the dependencies for PHP and when I accept them it will install and configure IIS7 to run PHP applications.
You can now take a quick cup of coffee and when you return your machine is able to run. To prove it we’ll create a website to run phpinfo();
To do that click the start button and type iis in the search box. This will get you the IIS manager. In the IIS manager create a new Virtual Directory under the default site.
In the directory in my case c:\test create a file with phpinfo();
Et voila you have a running Windows Server 2008 dev environment in a Virtual Machine.
In this WinPHP series I’ll create the following follow up posts:
- Managing Sites and deploying to a hosted server
- Audio / Video
If we still have time maybe I’ll do a bit more. This will also by the way be the basis of my DevDays 2009 talk.