Test Your Site Locally With WAMP/MAMP

Wouldn’t it be useful to be able to test a new version of your website locally, on your own computer, before putting it up on your server? Suppose you were working on a new design, and were coding it as a WordPress theme. You wouldn’t want to just edit it live, would you? While that’s fine for quick edits, if you’re overhauling your template it wouldn’t be a good idea…and we’ll leave it at that.

How would you go about setting up a local server? It’s dead easy if you’re running Windows or Mac OS X.

Windows users have WAMP, which stands for Windows Apache MySQL PHP, a play on the acronym LAMP. Just download it, unpack it, and run the installer. If you’re on a Mac, you have the Macintosh equivalent, known as MAMP.

Once you have the server installed, you can use it just like you would a remote server, albeit without the slow FTP/SSH upload times. The included copy of phpMyAdmin allows you to manage your MySQL databases. So you can throw a copy of WordPress or your CMS of choice into your *AMP server and copy your database over from your production server.

  • http://akamike.net/ Mike Robinson

    MAMP is fantastic, I use it at work for local development.A word of advice to those developing sites locally: Using virtual hosts can prove very useful when it comes to moving a site from local to live, as opposed to directories. Using directories would make your local dev server URLs look like “http://localhost/exampleclient.com/” which is a pain for relative URLs (can’t do “/images/” to access the images folder at the root, since the site isn’t in the root folder).Using virtual host URLs like “http://exampleclient.com.dev” means your relative URLs will work when you move it over to exampleclient.com. Less editing, less frustration as you realise assets aren’t loading because you missed a few. ;)

  • http://www.mealybar.co.uk/ Richard

    MAMP, XAMPP, WAMP….. they’re all fantastic, with one caveat. Always test on a private part of your server after testing using one of them. Eg: code locally, test locally, test privatly at eg: beta.your-url.com, and then push it live.The problem is usually your web server is running a different version of something, and that might be as low down as web server is Linux, while you’re developing on a Windows machine. The setup is different, and in some situations can cause errors.

  • http://www.webmaster-source.com Matt

    @Mike Robinson, Nice tip.

    @Richard, That’s always a good idea. Not just because of configuration issues, but errors as well. You’d be surprised how often a slip of the mind, forgetting to change an absolute path somewhere, not updating database authentication details, etc, can throw a wrench in the works of what you thought would be a seamless update.

  • http://www.timelessinformation.com Armen Shirvanian

    I used XAMPP for a bit, and that helped me to understand more of the underlying way that items are run in connection with WordPress.  It was nice to be able to test items that were related to a site in a privately-hosted area that could be altered and checked quite quickly.  I like how PHP can serve numerous functions in a fairly easy to understand format.

  • Jason

    Is there a way to configure MAMP on OS X to treat each local dev site as the absolute root?

  • http://www.webmaster-source.com Matt

    @Jason, you’re definitely asking the wrong person. I’m no expert on server configuration (part of why I like MAMP). Hopefully I will know more of this subject in the future, but until then the best I can do is send you to the experts:

    http://forum.webedition.de/php.....m.php?f=13

    This is the link to the official MAMP forum, where I’m sure they’re very knowledgeable on matters such as this. I hope you find the solution to your question.

  • mike

    i was wondering how you could network computers so that you could test features like php designed chat sites? if so please show me how.