Introduction
This is the fifth article of a series of blog post called the WIMPinator Chronicles that describe how to setup a PHP development environment for Windows 7 and IIS 7.5.
So far we covered how to install a Wordpress blog and all its dependencies using the WPI (Web Platform Installer). Then we added additional features and extensions to the PHP deployment on Windows for IIS. I explained how to get PEAR setup and how to download and deploy the PHPUnit unit testing framework using PEAR. Finally I installed Eclipse PDT that I is my preferred IDE for PHP.
In this part I am going to hook up Eclipse to my subversion source control service.
The Series
- Getting a Wordpress blog installed in a jiffy on Windows 7 using the Web Platform Installer
- Adding additional features to PHP
- Installing PEAR and PHPUnit
- Installing Eclipse PDT
- Configuring Eclipse PDT to work with Subversion source control
- Configuring Eclipse to work with Ant build tasks
- Creating a new IIS 7.5 fast CGI web site
- Setting up XDebug with Eclipse and IIS 7.5
- Setting up the Zend Debugger with Eclipse and IIS 7.5
- Configuring Ruby and Watir
- Moving a Wordpress blog from GoDaddy shared hosting to my local debugging system.
Integrating Eclipse with Subversion
General comments
There are basically two general approaches to use Subversion with Eclipse. First you can just use shell commands like the SVN command line client or, on Windows, TortoiseSVN. And second you can use Subclipse, which is an Eclipse plug-in that gives you Subversion access from within the Eclipse IDE.
This article explains how to install, configure and use Subclipse within Eclipse on Windows 7.
Subclipse links
Subclipse Subversion IDE access can be downloaded manually from here, but, hold on, Eclipse provides a much easier way installing it via a wizard that just needs a URL.
Installing the Subclipse Eclipse plug-in
This article is specific to Windows 7, Eclipse Galileo and Subversion 1.6.
Note: More general instructions that refer to different versions of Subversion use the following link: http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
Start Eclipse and go to the the main menu: Help\Install New Software…. This will open the following dialog.
Figure 1: Available Software
Click the Add… button on the top right corner to add a new site. A site is basically a URL from which additional software/plug-ins can be downloaded from. Enter the following information:
Name: Subclipse
URL: http://subclipse.tigris.org/update_1.6.x
Figure 2: Add new site
After confirming the Add Site dialog by pressing OK, you will see the download details for Subclipse. Select the top level node of the just added Subclipse site.
Figure 3: Select all features of Subclipse by clicking the top level checkbox
Then click the Next button to get to a summary of selected Subclipse features.
Figure 4: Summary of selected Subclipse features
Then click Next again and click on the radio button to accept license agreement.
Figure 5: Accept license agreement
Now you can a push the Finish button to start the installation process.
Figure 6: Subclipse installation progress
After the the download and installation are complete you might be asked to restart Eclipse. Click Yes and try to restart Eclipse.
Figure 7: Restart Eclipse
Unfortunately restarting didn’t succeed when I tried it, but I got this error message instead during the startup of Eclipse.
Figure 8: Workspace Unavailable error message
I goggled this particular error and found the following solution:
Just delete $workspace_dir/.metadata/.lock and you should be up and running again. In my case this path mapped into the following folder
C:\Users\Klaus\eclipse\workspace\.metadata\.lock
Figure 9: Delete the .lock file in the workspace metadata folder
Of course I was curious why the .lock file didn’t get deleted after the shutdown of Eclipse and I suspected that Eclipse actually didn’t shutdown completely and a second instance was starting prematurely. Before starting Eclipse again I made sure that all instances of Eclipse.exe where terminated using the Windows Task Manager.
Figure 10: Make sure that all Eclipse.exe process instances are gone, before staring Eclipse again
Finally I managed to restart the IDE.
To use Subclipse, go in Eclipse to the menu Window\Open Perspective\Other…
Figure 11: Change the Perspective
This shows the Open Perspective dialog. Select the SVN Repository Exploring perspective and hit OK.
Figure 12: Choose the SVN Repository Exploring Perspective
Configuring your Subversion Server and Repository location
Once the Subversion perspective is open, right mouse click and select the menu New/Repository Location to open the Add SVN Repository dialog.
Figure 13: Open the Add New Repository Location dialog
Specify the location of your repository

Figure 14: Specify the location of your repository
My test Subversion repository already contained one file called SyntaxPlayground.php that got listed in Eclipse after connecting to my SVN server.
Figure 15: Exploring my Subversion repository with Subclipse
To download a local working copy and edit the files of the repository you need to check-out the subversion folder. Right click on the SVN Repository and choose Checkout…
Figure 16: Get a local working copy of your Subversion file by using the checkout command
You can select from two options during the checkout. I selected the first option: Checkout as a project configured using the New Project Wizard. If you already working on a project, you can choose the second option.
Figure 17: Check out and create new Project
Select the new PHP Project option during the second step of the wizard.
Figure 18: New PHP Project
Give your project a new name and select Create new project in workspace.
Figure 19: Provide a project name
Click next to customize the Include Path. I left the defaults.
Figure 20: Customizing the include path
Click next to customize the Build Path. Again, the default settings will do the trick.
Figure 21: Customizing the build path
Finally click Finish. The PHP project will be created and you will be asked to allow the opening of the PHP perspective. You agree and click Yes.
Figure 22: Switch to the PHP Perspective
The following dialog warns you about potential conflicts when downloading files from the repository. These files will be replacing files in your project that have the same name.
Figure 23: Confirm Overwrite
The next screenshot shows my PHP Project with one file from the Subversion Repository.
Figure 24: PHP project under source control
Basic Source Control operations
The following section describes some basic source control operations. For a more complete list of commands see the following link http://agile.csc.ncsu.edu/SEMaterials/tutorials/subclipse/index.html#section7_0.
As a general note, you can find all Subclipse Subversion commands when you select a source code file or the project node in the PHP perspective and open the right mouse click menu. All Subclipse entries are under the Team menu.
Check-in or Commit
Just select the file, folder or project and do Team\Commit.
The following screenshot shows the whole list of options.
Figure 25: Subclipse commands
As part of the commit command you get a chance to enter a check-in comment.
Figure 26: Enter a check-in comment
Once the file is checked-in you can see the check-in date and the user name who checked the file in next to the file name in the project tree.
Figure 27: Version details
Synchronize with the Repository
Another important Subclipse use case is to synchronize your local project files with the repository. For example other developers could have checked-in files or you could have worked on a different computer and modified source code. Use the Team/Update command to get the latest files form the repository. In the worst case there are two copies of the same file that need to be merged . The Team Synchronizing perspective is the perfect tool for this. You either can select Team/Synchronize or open the Team Synchronize perspective explicitly.

Figure 28: Opening the Team Synchronizing perspective
The following screenshot shows an example of the Team Synchronizing perspective.
Figure 28: The Team Synchronization Perspective
Update will add the new files from the repository to the project. Commit will add the new files from the project to the repository.
The next screenshot shows the options that the Team Synchronizing perspective offers.
Figure 29: Synchronizing commands
Finally after doing updates and commits, the repository and the local project files are in sync and should have all changes included.
Ausblick
Eclipse provides a way to exclude files from being committed to the source control server. Please check-out (:-) the following blog post to get an idea how to configure file exclusions: Enforcing PHP coding standards with Eclipse PDT. This also concludes the this article. In the next post I am going to talk about deploying your PHP project files to an IIS 7.5 web server. There are two parts to it: First we need to check that the web server and the web site are configured properly to run PHP applications (Part 6) and second we need to automate the deployment of the website from Eclipse to IIS using an ANT build task (Part 7).