Make sure you read the footnote about Placing Your Script on the Server . If nothing there works, then find out how CGI scripts should be configured on your server. Ask your webmaster, or system administrator, or whoever is in charge of your Web server. If you are running your own server, then read the server documentation. Install one of the sample scripts to make sure your CGI setup is working.
Every server is configured differently.
You are in a better position to figure out your own server than I am. Here is my script. Please look at it and tell me why it doesn't work. Nothing personal, but I don't have time to debug everybody's CGI scripts. Isolate exactly what is going wrong by removing as much as possible from your program.