Well, a 500 error is about as useless to us as it is to you
What do your error logs say? Can you run your CGI script from the shell and, if so, does it work there? Are you sure that you’re serving up a Content-Type header from within your CGI script itself? Did you set your CGI script to be executable?
If you can answer those questions, it’ll help give us a better idea what’s going wrong with your script. If you’re willing to post your source code, that might be helpful too.