PHP is a great web development language, but it can be awkward to test and
debug. Unlike
ASP.Net
and
Visual
Studio, there’s no standard PHP IDE, and developers take a variety of
approaches.
The old trick of using functions such as echo or var_dump, to output current
values to the browser for testing, still works, but it is more arduous than
using a proper debugger, especially when you need to trace a complex execution
path.
It is worth setting up a PHP debugging environment on your own machine,
though, so you can develop and test in convenience and safety.
The option I’ve picked for this tutorial is
Eclipse,
the free tools platform best known as a Java IDE. Eclipse has a huge range of
add-ons, one of which is the PHP Developer Tools project. Eclipse is not the
whole answer, though. To set this up, you need Wamp
(Windows,
Apache,
MySQL,
PHP),
a PHP debugger and Eclipse.
Preparation
There are a few tools that are useful for working with Linux or Mac files on
Windows. When extracting archives, the tool that is built into Windows sometimes
has problems with Unix archives and doesn’t support all the formats you might
need. However,
Grab
7-Zip works perfectly.
Another annoyance comes when you try editing Linux text configuration files
in Notepad. Windows has another way of dealing with line endings and runs all
the text together. Install
Notepad++
or another suitable editor.
Java
Eclipse won’t run without
Java,
and it makes sense to get the official Sun version. Eclipse recommends a Java 5
JRE (Java Runtime Environment), but in my tests, the latest version 6 worked
fine.
Reader comments