make write.php only callable via sapi, use a clearer log message in sapi context, remove a temp include