February 2nd, 2012, 04:49 PM
How can send output of my interpreter to the browser?
Hi, sorry for my english and i hope to post in the right place.
My question is simple (i hope). I had wrote an interpreted line command web language based on C.
I had configured Apache cgi-bin to execute scripts. In the cgi-bin dir, Perl and Python scripts working fine but my own scripts show always this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
The first line that run the language interpreter I'm sure is correct... what's wrong? What I must to set or send to the browser exactly?
February 2nd, 2012, 09:51 PM
What does the error message in the log file say?
For an "Internal Server Error" message it normally means that something isn't configured correctly in the server software, or that the server software doesn't know what you want it to do from your request. Unfortunately that's about all that we can tell you without knowing what the actual error is.
February 3rd, 2012, 04:07 AM
Some more info....
this is the error line in the Apache Log:
[Fri Feb 03 10:54:50 2012] [error] [client 127.0.0.1] malformed header from script. Bad header=ciao: demo.bpl
(I understand something wrong with header but I don't know what and what to pass to...)
This is the first line I use to execute the script:
My lang: #!c:/NEWLANG/compiler.exe
My script use 1 only line after first one:
Like web server I use WAMP in localhost with Apache 2.2.11.
February 3rd, 2012, 05:37 AM
Some other tests....
If I put only this lines in the script:
The error message in the Apache log is:
echo "Content-type: text/html"
[Fri Feb 03 12:33:27 2012] [error] [client 127.0.0.1] Premature end of script headers: demo.bpl
... something in missing... what???
February 3rd, 2012, 07:46 AM
I found the problem!
At the end of my function, inside the compiler, I add only 1 "\n" line feed. I need to add 2 line feed "\n\n" between the "Content type..." and the commands lines of the script (echo).
Now in the compiler I have this:
at the end of function echo.
This because CGI Content needs an empty line after "Content type..." command ...