CGI program, 500 internal server error.

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
blu fire
-


Joined: 25 Aug 2004
Posts: 4

PostPosted: Sun Aug 29, 2004 3:18 am    Post subject: CGI program, 500 internal server error. Reply with quote

I have a web form with just a submit button. The code is as follows:
Code:
<form action="cgi-bin/program.bash" method="post">
  <input type="submit" />
</form>


In program.bash I have the following:
Code:
#!/bin/bash
echo 'Content-Type: text/html'
echo '<html><body>Boo</body></html>'
echo ''


This all works perfectly.
But if I change cgi-bin/program.bash in the form to cgi-bin/program.cgi (a C++ binary) which has the following in it:
Code:
#include <iostream>

int main() {
  std::cout << "Content-Type: text/html\n" << "<html><body>Blah</body></html>\n";
  return 0;
}
I receive a 500 internal server error. Whats happening? Its the same program....

Thanks for your time,
Paul
_________________
--
Back to top View user's profile Send private message
aprelium-beta
-


Joined: 24 Jun 2004
Posts: 383

PostPosted: Sun Aug 29, 2004 4:08 pm    Post subject: Re: CGI program, 500 internal server error. Reply with quote

Your CGI header is missing the empty line (which separates the Header from the body.) So change your code to (add another \n):

Code:

  std::cout << "Content-Type: text/html\n\n" << "<html><body>Blah</body></html>\n";
[/code]
_________________
Beta Testing Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
blu fire
-


Joined: 25 Aug 2004
Posts: 4

PostPosted: Mon Aug 30, 2004 12:05 pm    Post subject: Reply with quote

Thanks, that solved it :)
_________________
--
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group