loquela Posted March 6, 2007 Share Posted March 6, 2007 Hi there, I've reposted this query as a mistake in my first attempt threw evrybody off the real issue (I apologise): I'm pulling my hair out with this one. When this mail script is run (actioned from a seperate form), the mail appears to be sent fine but the HTML wont display because the script causes an internal error: malformed header from script. Bad header=/home/sites/e***ign.: confirm.php, referer: http://www.educationaldesign.co.uk/school_enquiry.php Can anybody see why the header is being corrupted? Here's the code: Code: <?php ini_set('arg_separator.output','&'); $enq=$_POST['enquiry_type']; $name=$_POST['name']; $org=$_POST['organisation']; $sch=$_POST['school']; $lea=$_POST['lea']; $email=$_POST['email']; $tel=$_POST['tel']; $fax=$_POST['fax']; $prod=$_POST['product']; $msg=$_POST['msg']; $pcms=$_POST['primary_cms']; $scms=$_POST['secondary_cms']; $body= "Dear {$name}, \nThank you for your enquiry. \nYour message has been received by the Educational Web Design team. \nYou sould receive a responce within the next 48 hours.\n\nEducational Web Design."; mail($email, 'Thank you for your Enquiry', $body, 'From: info@e*******.co.uk'); mail('info@*******.co.uk', /* Subject */ 'Educational Web Design - Web Enquiry', "Enquiry Type: {$enq}\n Name: {$name}\n Organisation: {$org}\n School:{$sch}\n LEA: {$lea}\n Email: {$email}\n Telephone: {$tel}\n Fax: {$fax}\n Product: {$prod}\n Message: {$msg}\n Primary CMS Demo: {$pcms}\n Secondary CMS Demo: {$scms}\n ", "From: {$email}"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>School Contact</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="title" content="Enquiry confirmation page" /> <meta name="author" content="Educational Web Design Limited" /> <meta name="description" content="Page confirming receipt of online enquiry" /> <meta name="keywords" content="online enquiry, confirmation" /> </head> <body> ...... I got this reply from another forum. Perhaps it helps... http://www.google.nl/search?q=%22malformed+header+from+script.+Bad+header%3D%22&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a Looks like the problem isn't PHP-specific, but rather CGI-specific (and that tells me that your PHP runs as a CGI app). But the solution ... I dunno ;; And my reply to this: Thanks Zyppora, I think you got it! I know this script is valid as I had it working on a previous server no problem. I also had other people test it. I have migrated to a new hosting provider and they insist on running php as cgi. So I am convinced it is a cgi problem and nothing to do with the PHP. Does anyone have an idea to a solution? If this turns out to be a cgi issue it could cause problems with any script. I need to find out how to get around it. Anybody out there have any clues???? Link to comment https://forums.phpfreaks.com/topic/41475-can-any-body-work-out-why-this-is-returning-an-error/ Share on other sites More sharing options...
nloding Posted March 6, 2007 Share Posted March 6, 2007 Start using Firefox (if you don't already) and install this extension: http://livehttpheaders.mozdev.org/ You can then view your headers, copy them, and post them here if need be. Then we can figure out where the bad header is coming from. Link to comment https://forums.phpfreaks.com/topic/41475-can-any-body-work-out-why-this-is-returning-an-error/#findComment-200974 Share on other sites More sharing options...
loquela Posted March 7, 2007 Author Share Posted March 7, 2007 Many thanks, Not sure what information you need. Here is the output from Page Info > Headers: from my page where the form is: GET /general_enquiry.php HTTP/1.1 www.educationaldesign.co.uk Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070216 Firefox/1.5.0.10 text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 en-us,en;q=0.5 gzip,deflate ISO-8859-1,utf-8;q=0.7,*;q=0.7 300 keep-alive __utma=107056214.1821490878.1173285502.1173285502.1173285502.1; __utmb=107056214; __utmc=107056214; __utmz=107056214.1173285502.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); style=default max-age=0 HTTP/1.1 200 OK Wed, 07 Mar 2007 16:54:13 GMT Apache/2.0.55 (Red Hat) PHP/4.4.4 timeout=15, max=99 Keep-Alive chunked text/html And here is the output form the php processing page: POST /confirm.php HTTP/1.1 www.educationaldesign.co.uk Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070216 Firefox/1.5.0.10 text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 en-us,en;q=0.5 gzip,deflate ISO-8859-1,utf-8;q=0.7,*;q=0.7 300 keep-alive http://www.educationaldesign.co.uk/general_enquiry.php __utma=107056214.1821490878.1173285502.1173285502.1173285502.1; __utmb=107056214; __utmc=107056214; __utmz=107056214.1173285502.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); style=default max-age=0 application/x-www-form-urlencoded 248 HTTP/1.1 500 Internal Server Error Wed, 07 Mar 2007 16:57:59 GMT Apache/2.0.55 (Red Hat) 647 close text/html; charset=iso-8859-1 I really hope this helps provide answers. Link to comment https://forums.phpfreaks.com/topic/41475-can-any-body-work-out-why-this-is-returning-an-error/#findComment-201779 Share on other sites More sharing options...
nloding Posted March 7, 2007 Share Posted March 7, 2007 Check the Apache error logs ... something more will be in there ... the HTTP/1.1 500 error is a general code, where the server didn't send anything more specific to the browser. http://www.communitymx.com/content/article.cfm?cid=A66B8 Link to comment https://forums.phpfreaks.com/topic/41475-can-any-body-work-out-why-this-is-returning-an-error/#findComment-201798 Share on other sites More sharing options...
loquela Posted March 7, 2007 Author Share Posted March 7, 2007 Thanks, Here is the server error: malformed header from script. Bad header=/home/sites/educationaldesign.: confirm.php, referer: http://www.educationaldesign.co.uk/school_enquiry.php Simon Link to comment https://forums.phpfreaks.com/topic/41475-can-any-body-work-out-why-this-is-returning-an-error/#findComment-201845 Share on other sites More sharing options...
anupam_28 Posted March 7, 2007 Share Posted March 7, 2007 i feel something wrong with mailheaders settings <?php ini_set('arg_separator.output', '&'); $enq = $_POST['enquiry_type']; $name = $_POST['name']; $org = $_POST['organisation']; $sch = $_POST['school']; $lea = $_POST['lea']; $email = $_POST['email']; $tel = $_POST['tel']; $fax = $_POST['fax']; $prod = $_POST['product']; $msg = $_POST['msg']; $pcms = $_POST['primary_cms']; $scms = $_POST['secondary_cms']; $mailheaders = "From: My Web Site <[email protected]>\n"; $mailheaders .= "Reply-To: ".$_POST["email"]; $body = "Dear {$name}, \nThank you for your enquiry. \nYour message has been received by the Educational Web Design team. \nYou sould receive a responce within the next 48 hours.\n\nEducational Web Design."; mail($email,$body, $mailheaders); //try setting mail like this Link to comment https://forums.phpfreaks.com/topic/41475-can-any-body-work-out-why-this-is-returning-an-error/#findComment-201927 Share on other sites More sharing options...
loquela Posted March 8, 2007 Author Share Posted March 8, 2007 Thank, But, no, that's not it. Still get the same error. :'( Link to comment https://forums.phpfreaks.com/topic/41475-can-any-body-work-out-why-this-is-returning-an-error/#findComment-202632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.