I use auto_prepend_file in php.ini for this.
It includes a file that has (among others)
PHP Code:
defined('DEVELOPENT_SERVER') or define('DEVELOPMENT_SERVER', true);
and in the index/bootstrap file of projects I have
PHP Code:
defined('DEVELOPENT_SERVER') or define('DEVELOPMENT_SERVER', false);
Since you can also set this in the php.ini for CLI, it should also cover cron jobs.
It's the easiest way I've been able to come up with so far.
Edit:
Forgot to mention: I have that auto_prepend_file on dev server(s) only, otherwise the approach doesn't make sense
Bookmarks