Debugging is an acquired skill. As is often said in the development world, “You are given all the rope you should ever need; just attempt to tie a pretty bow with it rather than getting yourself hanged.” It naturally stands to reason that the more debugging you do, the more proficient you will become. With over 20 years of programming time in my career, I can now often debug code just by looking at it. Of course, you will also get some excellent hints from your server environment when your code does not deliver what you were expecting. Before we get too deep into debugging concepts, however, we need to look at the bigger picture and discuss these programming environments. Every development shop has its own setup and its own way of doing things, so what we will be covering here would be what is considered among the ideal environments, also known as best practices.
Ideally, PHP development in a utopian world would have at least three separate environments in which work is being done. They are development, staging, and production, and we shall explore each environment in the following sections.