[Make sure you check out Part 2 here!]
For many, developing sites and applications for the web usually consists of editing files on the local machine, uploading them to the server, testing it out in a browser, and repeating the process until all the desired changes are in place.
Yep – it’s tedious, but it doesn’t have to be like this. It’s totally possible to develop entire projects locally prior to deploying them. Personally, I am all for having the development environment mirror the production system as much as possible. This helps not only improve development time, but also helps to reduce the number of issues that may crop up when the project launches.
Admittedly, configurations will vary based on what languages and platform you’ve chosen for your project, but I know many in the 8BIT Community use a combination of PHP, MySQL, and the usual client-side languages.
In this series, I’ll be covering how to install and configure a local development environment (regardless of your operating system), then we’ll take a look and installing a copy of WordPress for local development.
Okay, cool. Let’s do this.
To get started, you need three specific packages – a web server, a database management system, and PHP. Although it’s possible to install all of these packages separately, there’s a lot of configuration that has to be done – we’re looking to get up an running as quickly as possible.
Enter XAMPP. It’s a free, all-in-one utility for installing the Apache web server, MySQL database server, PHP, and a few other packages to help get you going quickly. It’s compatible with Linux, Mac, and Windows.
Once you’ve downloaded it, go ahead and run the setup program. The installation will prompt you for where to place the files (i.e., C:xampp). Any location is fine – I’m on Windows so I usually keep my application files in ‘Program Files.’
Once it is installed, you should have a directory structure like this:
Post-Install Modifications
Before starting development, there are a few changes that I always like to make to the generic install.
First, we want to enable PHP short-codes. Many PHP applications utilize a convention that doesn’t always play nice with the default XAMPP install. In your PHP.ini file (which should be located in C:Program Filesxamppphp), find this line:
Update it to equal “on,” save, and you’re done.
Secondly, I like to use SQLBuddy as my database frontend (as opposed to PHPMyAdmin). If you’re fine sticking with the default option, then you can skip this step; otherwise, let’s install it. Grab a copy from the website and extract the application to your htdocs (C:Program Filesxampphtdocs) folder.
Note that SQLBuddy should remain in its own folder (C:Program Filesxampphtdocssqlbuddy) – don’t empty all the files into the htdocs directory.
Start Developing
Alright, so we’re ready to get started. Let’s test thing this out. Go ahead an launch the XAMPP Control Panel and start Apache and MySQL.
If all is good, both services should start running. If not, verify that you’ve not made any typos or file errors in the aforementioned steps. Launch your browser and point it to http://localhost. If all is good, then you should see the following screen:
Finally, let’s make sure that SQLBuddy is properly installed. Point your browser to http://localhost/sqlbuddy. From here, go ahead and login as root (without a password). You should land welcome screen. Of course, there’s not much to do yet since there are no databases. We’ll cover that in the next article.
At this point, feel free to play around with the installation. Create a directory in your httpdocs folder, say /killer_app/, and create an index.html file. Add some goodness to it, then point your browser to http://localhost/killer_app. The page should load up without problem.
Next up, we’ll do a local installation of WordPress and leverage PHP and SQLBuddy to make the magic happen. We’ll take a look at how we can tweak changes on our local system before pushing them live for the world to see.
Sound good?
Micah Choquette says
I’m certainly not opposed to a free method, but after struggling with XAMPP and MAMP on the mac, I finally broke down and got MAMP Pro. Best $60 I’ve ever spent at one time, since it allows me to do local dev easy-peasy.
Tom says
Exactly. Gotta work with whatever works with you ;).
PhillipGibb says
very cool, just what I need to fix my local wordpress install and php work, semi php work 😛
Tom says
😉
Matt Phelps says
I’ve had XAMPP installed on a networked computer that also acts as the centralized backup server and a weather logger for a while now, and I love it. I can upload files using Filezilla then jump over to Firefox to test it, all at full network speed. Used it for developing several sites, some with WordPress, some with a custom-built system.
Tom says
That’s awesome.
I’ve actually pointed the platform to a directory in my Dropbox folder. This way, I can have a copy of all my projects and development environment with me on whatever machine I’m on.