The solution? try chmoding the cgi script 777 and then run it.
Leaving the script at 0777 is very foolish. Do try this solution, but if it works, immediately re-set the file permissions to something harmless like 0744, and learn about unix permissions before you set it to something that works again.
The number 0777 may not mean a thing to you, so here's a small explanation: it allows everyone to run the file, read the file or change the file. When someone else changes the file, and you execute it, there might be disastrous results.
mt2k, please do never recommend 0777 as a mode for ANYTHING, as it's insecure. For executable scripts, 0755 should always be enough: that lets only yourself change it, but everyone can read or execute it.
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk