Jump to content

Need Help with CGI Error


cshinteractive

Recommended Posts

Hi Everyone,

 

I use the following PHP function on a Linux server with PHP version 4.3.10 without any problems.

 

function makeHTMLBody()

{

$htmlTemp = file(trim($this->HTMLTemplate));

$htmlBody = implode(" ",$htmlTemp);

 

return $htmlBody;

}

 

$this->HTMLTemplate equals the absolute path of my template script.

ie – “http://mydomain/Template/templatename.php”

 

I’m in the process of moving scripts to a Windows Server with PHP version 4.4.2 and get the following CGI Error when it executes the first statement of the function above. For some reason the php file() causes the error.

 

CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers.

 

I’m still fairly new to PHP about 6 months and not familiar with all the settings in the php.ini file or any necessary setting at the server level which would allow the php file() command to open or read the url passed to it.

 

Any ideas would be greatly appreciated.

 

I did change the code to use fopen() rather than file() and got the same CGI Error. Here’s my second attempt:

 

function makeHTMLBody()

{

$handleTemplate = fopen($this->HTMLTemplate, "r");

if ($handleTemplate) {

  while (!feof($handleTemplate)) {

      $htmlTemp[] = fgets($handleTemplate, 4096);

  }

  fclose($handle);

}

$htmlBody = implode(" ",$htmlTemp);

 

return $htmlBody;

}

 

Thanks for your help in advance,

Chris

Link to comment
https://forums.phpfreaks.com/topic/46897-need-help-with-cgi-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.