cshinteractive Posted April 13, 2007 Share Posted April 13, 2007 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 More sharing options...
craygo Posted April 13, 2007 Share Posted April 13, 2007 If you are using Windows with IIS you might not want use php as a cgi script. Read here http://bugs.php.net/bug.php?id=25863 To change use php.exe as the interpreter instead of the .dll file Ray Link to comment https://forums.phpfreaks.com/topic/46897-need-help-with-cgi-error/#findComment-228629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.