View previous topic :: View next topic |
Author |
Message |
arthurrichards77 -
Joined: 22 Jun 2002 Posts: 2 Location: Boston MA
|
Posted: Sat Jun 22, 2002 11:55 pm Post subject: CGI SOS |
|
|
I'm writing my CGI version 1.0: "Hello World"
I've used Free Pascal (www.freepascal.org) to ensure I get a win32 executable (its definitely getting further than my attempts with DJGPP)
The server gives me 'Error 500 - Internal Server Error'
The cgi log is empty but the access log reads:
127.0.0.1 - - [22/Jun/2002:18:51:38 +1133] "GET /cgi-bin/hello.exe HTTP/1.0" 500 450
The code is below - even if you're not a Pascal user, I'm sure you can follow it. I've tested redirecting the output to a file and it gives me the text lines I'd expect.
Any suggestions please?
Arthur
program hello;
begin
writeln('Content-type: text/html');
writeln('<HTML><HEAD>');
writeln('<TITLE>output of HTML from CGI script</TITLE>');
writeln('</HEAD><BODY>');
writeln('<H1>Sample output</H1>');
writeln('Hello World');
writeln('</BODY></HTML>');
end. |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sun Jun 23, 2002 2:24 pm Post subject: Re: CGI SOS |
|
|
arthurrichards77 wrote: | I'm writing my CGI version 1.0: "Hello World"
I've used Free Pascal (www.freepascal.org) to ensure I get a win32 executable (its definitely getting further than my attempts with DJGPP)
The server gives me 'Error 500 - Internal Server Error'
The cgi log is empty but the access log reads:
127.0.0.1 - - [22/Jun/2002:18:51:38 +1133] "GET /cgi-bin/hello.exe HTTP/1.0" 500 450
|
In CGI, the headers and the body must be separted by a blank line (a line with a carriage return only in it). So in your case, your code is missing another writeln after the first.
The code should be:
Code: |
program hello;
begin
writeln('Content-type: text/html');
writeln;
writeln('<HTML><HEAD>');
writeln('<TITLE>output of HTML from CGI script</TITLE>');
writeln('</HEAD><BODY>');
writeln('<H1>Sample output</H1>');
writeln('Hello World');
writeln('</BODY></HTML>');
end.
|
_________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
arthurrichards77 -
Joined: 22 Jun 2002 Posts: 2 Location: Boston MA
|
Posted: Sun Jun 23, 2002 4:07 pm Post subject: sorted! |
|
|
works like a charm - thanks for your help
furthermore, for general interest, I've started using the free C compiler mingw32 instead of DJGPP. Just include windows.h in your existing C file and it works just fine. No more Pascal.
Thanks again |
|
Back to top |
|
|
|