WP_DEBUG for multisite

In a multisite setup, you probably don’t want to turn on debugging for all your sites. Rather, just one or two.

Take a look at the $_SERVER global array – then go with conditional if/else.

For a single site, maybe:

define('WP_DEBUG', $_SERVER['HTTP_HOST']=='www.jamesfishwick.com');

For a couple sites, perhaps

if ($_SERVER['SERVER_NAME']== 'foo.jamesfishwick.com' || 'baz.jamesfishwick.com' )
  define('WP_DEBUG', true);
else 
  define('WP_DEBUG', false);

FYI:

$_SERVER['SERVER_NAME'] is based on your web servers’ config file (Apache2 in my case), and varies depending on a few directives: (1) VirtualHost, (2) ServerName, (3) UseCanonicalName, etc.

$_SERVER['HTTP_HOST'] is based on the request from the client, i.e. what is in the address bar.

What say you?