Better handling when PHP is running as a CGI