Setting up a robust development environment for WordPress

For a while now I’ve been wanting to create a better development environment for myself for working on my WordPress blogs, and other php projects too. I thought that in itself, this would be a good project to blog about as I set it up, explain and justify what I’m doing, see what other people are doing in similar areas for comparison. Also it might be helpful to people wanting to set up such an environment for themselves, or who want to set up an element of it. I’m going to break it down into several posts, which I’ll gradually link to from this post.

I’ll be setting up a new blog at flotsky.com, which with the new WordPress 3.0 I’ll be able to make a multiple blog installation, able to run whole new blogs underneath this. I’m also hoping to use a plugin to help me set this up with different domains for some of these blogs, so for instance there will be a flotsky.org blog with a different look and feel, but only one install of WordPress and its plugins to upgrade and develop. Finally I’m hoping to then move this blog itself from WordPress to Drupal, as that’s a CMS I need to learn more about too.

So what am I looking for in this development environment?

Security

I want to be able to test changes to the site without affecting the live site. If something breaks on the live site, I’d like to be able to revert back to the previous version easily, get the site back up and running, and fix it in the test environment. So I need a test version of the site, and I need version control, allowing me to make releases of the site, and access previous version.

Mac-based

This is my own personal preference, I work on Macs for both my day job and my own stuff, so it makes sense. However all the tools I’ll use will either be available on Windows and Linux, or will have very close equivalents. Much of what I’m going to do will be within an IDE (Integrated Development Environment) available for all platforms, so my setup will be transferable should I need to (or should other wish to try it too).

Integrated

I like using only a few tools for developing. Where possible, I want to do all the work within the IDE, and then test in a browser. For instance I currently use Cyberduck for FTP, but I’d rather do this within the IDE (and I’ve got this figured out now).

So, in order that I can do all this, I’ve selected a few tools.

Netbeans

I’ve used Netbeans for a year or two now as my main IDE. It is at heart a Java IDE, but its support for other languages has improved quite a bit, and the bulk of what I’ll be working on, PHP, HTML and CSS are well supported, with code completion and syntax for all, and the promise of good testing support for PHP in particular (this is something I want to delve into more as I go along). As a downside it can be a bit memory hungry, but I’ve found it more stable than Eclipse which I used before.

Subversion

Subversion has been my version control system for a few years now at work, so this is a simple choice for me, as I know it best. I’ve not had much experience of CVS, and there are good guides and advice available for Subversion, so as something new to setting up their own versioning system for themselves, it makes sense to stick with what I know.

MAMP

MAMP is Mac Apache Mysql PHP server. This is what will allow me to run a whole site on my local machine and test it easily. It’s pretty easy to set up, and also allows me to configure a more complex testing environment later on. I could have chosen to have a “live” test site on my webhost, and this may be a more suitable option for some people, obviously where you might have more than one potential user of the site itself.

So this is the basic setup I want (and have set up already, but will explain it in more detail as I get it working better). I want to use this to have a process for development where I can:

  • Work and test on my local machine.
  • Make a release version.
  • Save this in my versioning system.
  • Send to my live server.

The next post will be about setting up Subversion on the Mac. I’d be interested to hear other people’s experiences of setting up similar environments, and suggestions for different approaches to what I’m planning.