We help IT Professionals succeed at work.

problems with cgi programming in c++

bhksharma asked
dear samri
i have added the following in the httpd.conf file apache
    ScriptAlias /cgi-bin/ "e:/Program Files/cgi-bin/"
    # "e:/Program Files/Apache Group/Apache/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
          <Directory "e:/Program Files/Apache Group/Apache/cgi-bin">
       AllowOverride None
       Options None
       Order allow,deny
       Allow from all
 The following error gets displayed when i tried to run the program in the browser.

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@magnasoft 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.
Apache/1.3.22 Server at harikris.lk Port 80

The following is the error displayed in the server's log file
[Fri Mar 01 15:40:44 2002] [error] [client] malformed header from script. Bad header=<html><title> Sample CGI C++ S: e:/program files/cgi-bin/test.exe

could u please let me know how to proceed further?
Watch Question

Software Craftsman
Before outputting your actual HTML response, you'll need to write some headers from your CGI.  At the very least, try sending "Content-type: text/html\n\n" first.  There are other headers you can send (for example, if you want to send the user a cookie, or specify the length of what you are sending) but that should get you started.

Basically, you send the headers first, one per line, then a blank line, then your content (whatever it is; could be HTML, text, binary data for a GIF or JPG, etc. etc.)

Hope this helps.

Dear bhksharma

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "cwrea "

comment(s) as an answer.

Force accepted

** Mindphaser - Community Support Moderator **

Explore More ContentExplore courses, solutions, and other research materials related to this topic.