i wrote a html file in /var/www/cgi-bin....

You probably don't want to do that :-)

Your web server is probably configured to execute any files served from your cgi-bin directory. That makes sense as that's what the cgi-bin directory is for.

Therefore, any time your web server gets a request for a file in your cgi-bin directory, it tries to execute that file and return the output to the user.

An HTML file is not an executable program. Therefore the web server can't execute it and your operating system generates the error that you see.

The solution is to put cgi programs in the cgi-bin directory and static HTML files in the htdocs directory (or whatever the equivalent is in your configuration).

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg


In reply to Re: exec format error with CGI program by davorg
in thread exec format error with CGI program by lax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.