Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache 2.0 1

Status
Not open for further replies.

Cagliostro

Programmer
Sep 13, 2000
4,226
GB
Hi,
I want to make C++ gci programs under Apache2. I use Windows2000 proffessional. Any thing I do I get some error like it is a bad header in the .exe and in .cgi files. In my opinion it interprets .exe and .cgi files as textual scripts, same as PHP or PERL. As result does not want to execute them. Ion Filipski
1c.bmp


filipski@excite.com
 
The Bad header error means that your application isn't a valid CGI application. This is most oftenly caused by not outputing or outputing something before you output the Content-type header (which is the only header you are REQUIRED to send). //Daniel
 
could you give me a sample of such valid header? Ion Filipski
1c.bmp


filipski@excite.com
 
#!/usr/bin/perl

echo "Content-type: text/html\n\n";

echo &quot;<html><body>\n&quot;; Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
NewPoster, do you suggest me to put in an .exe file your header or you have not read attentive my question? Ion Filipski
1c.bmp


filipski@excite.com
 
Hi, Daniel,
The same .exe programs run normally in older versions of Apache, but on this version I get always this error. Is there some new fetures or bugs? Ion Filipski
1c.bmp


filipski@excite.com
 
It might be a Windows issue, as this simple program works fine on my Linux server just fine.

Code:
#include <stdio.h>

int main(int argc, char **argv)
{
        printf(&quot;Content-Type: text/plain\r\n\r\n&quot;);
        printf(&quot;Hi, welcome to the C application\r\n&quot;);
        return 0;
}
//Daniel
 
The trouble is what I have quite the same code. It worked fine with an older version of Apache. Sometimes this code works fine but sometime it put the Content-Type: text/html into the html just in the broswer, other times it ask me if I want to download the .exe file or to open it. The same is with PHP.

#include <iostream>
using std::cout;
using std::endl;

int main(int argc, char **argv)
{
cout<<&quot;Content-Type: text/html&quot; <<endl <<endl;
cout<< &quot;<html>&quot; << endl;
cout<< &quot;<head>&quot;<< endl;
cout<< &quot; <title>some title</title>&quot;<< endl;
cout<< &quot;</head>&quot;<< endl;
cout<< &quot;<body>&quot; << endl;
cout<< &quot; <p>some body here</p>&quot;<< endl;
cout<< &quot;<body>&quot;<< endl;
cout<< &quot;</html>&quot; << endl;
return 0;
} Ion Filipski
1c.bmp


filipski@excite.com
 
I think there is a misconfiguration or something like it, but I can't understand what kind of misconfiguration is :( Ion Filipski
1c.bmp


filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top