Fix logging when scripts are run from Apache/PHP.