I get a \"Premature end of script headers: contactform.cgi\" error message when running the below script. What frustrates me is that I ran this as a .php on another server
u forgot to add proper content-type header in the response which is a must have http header when hosting on apache2
use
print "Content-type:text/html\r\n\r\n"
or
header('Content-Type: text/html');