Skip to content

Web Developers: You must code on a testbed server before deploying!

Here's why and how to set up a local testbed server

I'm still learning ways to do things better, and I'm always open to new ideas for improvement, but this development work flow seems to work for me the best:

  1. Code, Locally

    The optimal configuration for web site development is to run a web server on the same computer you're using for development. I know a lot of people will disagree with this. Why?

    • "Too much hassle"

    • There are REALLY good solutions to this, namely XAMPP and MAMP. These projects are pre-configured for a web server running Apache, MySQL, PHP, Perl, Python, and more. The program can be run in Windows or MacOS environments.

    • "There's no point, just code it on a remote server"

    • The main problem with this is trying to work when internet access is unavailable. Also, most people don't have direct access to change the remote server configuration. That can be a problem if the ISP doesn't provide remote debugging.

    Why is coding on a local server better?

    • You don't have to be connected to the net

    • This speaks for itself. I want to be able to develop websites no matter where I am. No way to do that without developing on my local PC.

    • Expand your horizons

    • You call yourself a web developer, but you only know HTML and CSS? By setting up XAMPP, you'll get a better feel for important applications that help make the web possible: Apache, PHP, MySQL. It'll also give you a better idea of what your code is doing on the server end, ultimately making you a better developer.

    • Debugging

    • You can set up debugging on a remote server, but if you can do that remotely, it's just as easy to do it on your local machine. That way you can debug while you're on an airplane.

  2. Test/Debug Locally

  3. So you've got XAMPP set up on your desk/laptop and you're really to start coding. Have you ever tried coding in an IDE? In some cases, the difference can be night and day. I learned to code in C# and the Visual Studio IDE was irreplacible in helping me learn the language syntax and speeding up Windows app development in general. Right after that, a friend and I coded ~20,000 lines of PHP for a website in a simple text editor (EditPad). The difference was night and day. I still use EditPad for quick changes, but my current IDE of choice is Netbeans 6.5. It has integrated support for XDebug, making it infinitely easier to find bugs in (my friend's part of) the code. It can also help in learning how PHP works.

    For instance, set a breakpoint and step thru some code, watching which variables are held in memory. I discovered all kinds of stuff allowing me to write nice code I wouldn't have known to do otherwise. If you are a level 10 guru in PHP then you can probably execute a script in your head. This is for the rest of us.

    I keep a mirrored copy of whatever website I'm working on on my local hard drive. I make some changes, like adding an image popup. I test it and debug it locally, and when it's all working I ...

  4. Upload

  5. .. to commit changes. I usually do this at an off-peak time. Sometimes slight differences in server configuration can cause a working script on a local server to go bonkers on the remote server. For instance, a server I was developing a website on had PHP magic quotes enabled, while my XAMPP installation did not.

  6. Repeat

  7. Once you get a new feature committed and it seems to be working good for everyone, keep coding and keep learning!

Resources:

Published inDevelopment

One Comment

Leave a Reply