magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1999 > 03 > Script Junkie

PHP Debugging with Class

By Phil Glatz

It's hard to debug a CGI program. After all, you're not actually running it (unless your name is httpd). But when those bugs show up, a little creative thinking will help you overcome that limitation. Let's talk about a technique I've found to be very useful for debugging CGI programs written with the PHP scripting language. While the same basic idea could be applied to CGI programs written in other languages, the class extensions to PHP make the process a little more elegant, as well as easy to apply to many CGI scripts without a lot of extra work. (If you're not familiar with PHP, see the box titled " What Is PHP?")

Debugging a CGI Script

When it comes to getting inside a CGI script, you can't use traditional techniques like PRINT statements or tracing program execution or failure. However, a CGI program does run linearly, as does any other structured program, so simple debugging statements can be directed to other output devices, such as a spool file. So, yes, you can insert PRINT statements within CGI to report the state of program variables or to display text strings to alert the developer of the progress through a program. But this sort of brute-force technique will interfere with the contents of the browser window, often causing more problems than it solves. Also, debugging information can be quite bewildering to the user when it appears on a production site, and there will be times when you still need to continue debugging even after a script goes live.<>




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2