It should be chmod'ed to 755 or 'rwxr-xr-x'. You also may need to print a header like:
print "Content-type: text/html", "\n\n";
That's two new lines after the contype. How to chmod try "man chmod" it's an easy learn. Hope this helps.