A local development environment consists of a server, a database, and a package of your server side language that runs on your machine. This is very useful when building and debugging your code because it is all internal; which saves from problems in the wild. You have the opportunity to extensively test your code and find problems before that feature or site ever goes live. You also don’t need to be connected to the internet to work with it either, which is nice if you are traveling and cannot find a solid connection.
Most of my experience with server side languages is with Apache, MySQL, and PHP, so that is what we will focus on.
Your going to need 3 main components to successfully run a local server:
- The server, most people choose: Apache
- A database, most people use: MySQL
- A release of your preferred scripting language: PHP
Thankfully, other developers have gotten tired of installing each of these components independently of each other and have created All-in-One package installers to complete this task and set your development environment for you. For your first installation, I would choose a AIO package just for simplicity sake, and as you become more familiar with the technology, installing each component independently will become easier.
There are several packages to choose from:
- Windows, Apache, MySQL, PHP: WAMP
- Mac, Apache, MySQL, PHP: MAMP
- Linux, Apache, MySQL, PHP: LAMP (I chose Ubuntu because that is what I use, and is one of the most popular Linux desktop distributions)
- Cross OS, Apache, MySQL, PHP, Perl: XAMPP
You should choose a method that you are comfortable. I currently use WAMP for my Windows environment and LAMP for my Linux environment. I have tried XAMPP but prefer the user interface included with the WAMP package. They did a really nice job making it as easy as possible to interact with. It is also the package that I began with and have the most experience with.
Remember to be mindful of which version and package you are downloading. If you are running a 64 bit OS, you will want to download the 64 bit client, and so on. There are certain technical caveats associated with your bit definition and how certain packages interact and work with each other and your system. If you are unsure of where to look or how to find out which bit your processor is running, look at this post “Knowing Your Bits” for help.
I am not going to include the installation details for each package listed in this post because they are included with the package release, and each package comes with a wizard to help complete the setup. The only exception is the LAMP package, and that is because of how Linux distributions work; XAMPP does include a wizard that will work on Linux though. This is why the package link leads to a tutorial, which I have personally followed to complete setup.
As stated earlier, I encourage you to begin you journey with an AIO package distribution for simplicity sake. They are by far easier to set up and begin using. You could potentially be writing you first “Hello World!” script within 15 minutes of downloading the package. Maintaining a package release is easy once it is in place, and the distributions will often let you have several versions of your preferred language installed at the same time, allowing you to easily switch between them. This is important if you are maintaining code in several different versions on different servers. Having the ability to switch between them easily cannot be overstated enough.
As always, I hope you found this post informational and useful.