For future reference:
This is typically an error that occurs when you are unable to view or execute the file, the reason for which is generally a permissions error. I would start by following @Renning 's suggestion and running chmod 755 test.cgi
(obviously replace test.cgi with the name of your cgi script here).
If that doesn't work there are a couple other things you can try. I once got this error when I created test.cgi
as root in another user's home. The fix there was to run chmod user:user test.cgi
where user is the name of the user who's home you're in.
The last thing I can think of is making sure that your cgi script is returning the proper headers. In my ruby script I did it by putting puts "Content-type: text/html"
before I actually outputted anything to the page.
Happy coding!