if your fprintf statements don't reach the apache error log, you may have to flush the output buffer:
fprintf(stderr, "error statement\n");
fflush(stderr);
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.