Php Script Problem - Used To Work, Now It Doesn't

windows

Guest
Hi guys, having a problem with a .php script that a friend of mine made (tried to get help from him but he is out of the country at the moment, and I would really like to get this fixed). It's a fairly straightforward script, which I have used with success on other websites (and my Totalchoicehosted site) to take the information from an html form and send it as text to an email address.<br /><br />What's so weird is that this script used to work on my TCH site, and in fact, only stopped working two weeks or so ago according to the client (I am jsut a designer). Now it brings up a page with a 500 Internal Server Error, script may be misconfigured, etcetc. It definitely used to work, I tested it heavily..and I have not made any changes to the script since. So to test, yesterday, I uploaded the script and the HTML form to another web domain (not TCH hosted) and it does work there as expected. (I receive the email, and the "Thank you" page displays).<br /><br />What could have gone wrong? I tried to contact TCH for support but they can't help with coding issues, but were able to share this:<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->I tried to reproduce the error and checked the logs. I was able to see the following error in the apache error file.<br /><br />Error<br />-----<br />[Mon Apr 25 20:49:11 2005][error] [client 202.56.253.42] Premature end of script headers: [...]/cgi-bin/thankyou.php<br />[Mon Apr 25 20:49:11 2005] [error] [client 202.56.253.42] File does not exist: [...]/500.shtml<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />I've looked at the script, but I haven't made any changes, so I'm at kind of a loss. Any suggestions for what could have gone wrong? I have tried deleting and reuploading the .php<br /><br />Thanks!<!--content-->
Have you or your client changed anything on the site--file permissions or .htaccess or anything like that?<br /><br />Also, if the PHP version was updated recently on your server, that might have affected something in your script. Without seeing your code, it's hard to tell what's going on. Is it short enough to post?<!--content-->
Hi,<br /><br />The error "Premature end of script headers:" is typically caused by a blank line after the end of your php code in one of the include files.<!--content-->
<!--QuoteBegin-owatagal+Apr 26 2005, 10:23 AM--><div class='quotetop'>QUOTE(owatagal @ Apr 26 2005, 10:23 AM)</div><div class='quotemain'><!--QuoteEBegin-->Have you or your client changed anything on the site--file permissions or .htaccess or anything like that?<br /><br />Also, if the PHP version was updated recently on your server, that might have affected something in your script. Without seeing your code, it's hard to tell what's going on. Is it short enough to post?<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=126672"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Yes, it's pretty short! Surrounding this, there is a lot of HTML, some javascript stuff, none of that could be causing the problem, though, right?<br />Here's the actual php part: <br /><br /><?php <br /> //////////////////////////////<br /> // Here we will do processing of the form into variables that will<br /> // be emailed out<br /> //////////////////////////////<br /> <br /> // Here are variables you can change<br /> $recipient = "[email protected]";<br /> $subject = "Booking";<br /> <br /> // Here we allocate the request information<br /> $engagementType = $_REQUEST["engagementType"];<br /> $dates = $_REQUEST["dates"];<br /> $audienceSize = $_REQUEST["audienceSize"];<br /> $groupName = $_REQUEST["groupName"];<br /> $contactPerson = $_REQUEST["contactPerson"];<br /> $address = $_REQUEST["address"]; <br /> $city = $_REQUEST["city"];<br /> $state = $_REQUEST["state"];<br /> $zip = $_REQUEST["zip"];<br /> $telephone = $_REQUEST["telephone"];<br /> $fax = $_REQUEST["fax"];<br /> $email = $_REQUEST["email"];<br /> $details = $_REQUEST["details"];<br /> <br /> $message = "Type of engagement: ${engagementType}\n" .<br /> "Tentative dates: ${dates}\n" .<br />"Audience Size: ${audienceSize}\n" .<br />"Organization: ${groupName}\n" .<br />"Contact Person: ${contactPerson}\n" .<br />"Address: ${address}\n" .<br />"City: ${city}\n" .<br />"State: ${state}\n" .<br />"Zip: ${zip}\n" .<br />"Telephone: ${telephone}\n" .<br />"Fax: ${fax}\n" .<br />"Email: ${email}\n" .<br />"Details: ${details}";<br /> <br /> mail($recipient,$subject,$message);<br />?><br /><br /><br />That's it!<br /><br />Thanks for the help guys<!--content-->
This is what the php code looks like in relation to the HTML/javascript tags.<br /><br />(random javascript code)<br />}<br />//--><br /></script><br /></head><br /><br /><body onLoad="MM_preloadImages('../../MAP/navbar/05intro_glow.jpg','../../MAP/navbar/05bio_glow.jpg','../../MAP/navbar/05music_glow.jpg','../../MAP/navbar/05booking_glow.jpg','../../MAP/navbar/05contact_glow.jpg','../images/insets/teachers.jpg')" onmousemove="closesubnav(event);"> <br /><br /><?php <br />(the php code posted above)<br /><br />?><br /><table width="778" border="0" align="center" cellpadding="0" cellspacing="0"><br /><tr><br />(more html)<!--content-->
Your script is missing $headers<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->mail($recipient,$subject,$message<b>,$headers</b>);<!--QuoteEnd--></div><!--QuoteEEnd--><!--content-->
<!--QuoteBegin-TCH-Bruce+Apr 27 2005, 11:02 AM--><div class='quotetop'>QUOTE(TCH-Bruce @ Apr 27 2005, 11:02 AM)</div><div class='quotemain'><!--QuoteEBegin-->Your script is missing $headers<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->mail($recipient,$subject,$message<b>,$headers</b>);<!--QuoteEnd--></div><!--QuoteEEnd--><br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=126918"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><br /><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />Thanks for the tip. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Tried to add that in, but it's still a "no-go." <br /><br /> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wallbash.gif" style="vertical-align:middle" emoid=":wallbash:" border="0" alt="wallbash.gif" /><!--content-->
TCH-Andy's comment on blank lines rings a bell with me too -- did you already check and make sure that wasn't the problem?<br /><br />When you added $headers to the mail line, did you ever define what $headers should be? If you just added "$headers" to the mail line, it won't have a value and so it wouldn't have fixed the problem. Try adding<br /><br />$headers = "From: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->";<br /><br />above the mail line and see if that helps.<!--content-->
<!--QuoteBegin-owatagal+Apr 27 2005, 02:58 PM--><div class='quotetop'>QUOTE(owatagal @ Apr 27 2005, 02:58 PM)</div><div class='quotemain'><!--QuoteEBegin-->TCH-Andy's comment on blank lines rings a bell with me too -- did you already check and make sure that wasn't the problem?<br /><br />When you added $headers to the mail line, did you ever define what $headers should be? If you just added "$headers" to the mail line, it won't have a value and so it wouldn't have fixed the problem. Try adding<br /><br />$headers = "From: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->";<br /><br />above the mail line and see if that helps.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=126955"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />Trying that now, I'm afraid I'm not sure what you mean by "blank lines" in the include file? Black lines in my php code? I figured it was like HTML, where hitting return to space out lines does not actually affect the way the stuff displays, but just helps the coder to organize.<!--content-->
Sigh, fixed. It was the littlest thing. I just had to move the .php file out of the cgi-bin folder and into the root folder with my form.htm<br /><br />Thanks for the help guys<!--content-->
Glad you found it.<br />Yep, php will not run in the cgi-bin.<!--content-->
 
Back
Top