in reply to Exec format error

Your web server is configured to execute any files in the cgi-bin as a result when you call test.html the server attempts to execute it.

Either change your server settings to execute on the basis of extension (.cgi or .pl) or move test.html to your htdocs directory

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: Exec format error
by Anonymous Monk on Dec 03, 2010 at 10:09 UTC
    Judging by what's in the file, it looks like test.html is meant to be executed...
      What he showed isn't test.html. "test.html is in the same directory as the perl script."
Re^2: Exec format error
by anu_1 (Acolyte) on Dec 03, 2010 at 10:19 UTC
    I have updated (AddHandler) the Apache httpd.conf to execute only .pl
    <Directory "mydir/tools/cgi-bin"> AllowOverride AuthConfig Options FollowSymLinks Order allow,deny Allow from all AddHandler cgi-script .pl </Directory>
    But still getting the same error. I am new to Apache configuration ...anything else needs to be done.. Thanks again...

      Please read the error message, your target file as a .html extension. Looks like your webserver is trying to execute an html file. Read the apache documentation for more information.

      <Directory "mydir/tools/cgi-bin"> ^
      I think the directory specification here needs to be a full (absolute) path in the filesystem. See <Directory>.
        sorry printing mistake...getting the same error with the following configuration
        <Directory "/mydir/tools/cgi-bin"> AddHandler cgi-script .pl AllowOverride AuthConfig Options FollowSymLinks Order allow,deny Allow from all </Directory>
      It's hard to tell without seeing the rest of the config... but maybe you also have a ScriptAlias directive set up for the directory. That would have the effect of Apache trying to execute any file in it (with the execute bit set)...

      It's probably a good idea to read up on and understand the subtle differences between ScriptAlias, option ExecCGI, SetHandler and AddHandler, and then re-check your config. Also don't forget to restart apache after having made any changes (just in case you didn't...)

      See also Dynamic Content with CGI for an overview, and Configuration Sections (for understanding which scope directives will apply to).

      If that still doesn't help, it's probably appropriate to switch to some webserver/apache forum, as the issue isn't really related to Perl at all...

        Thanks for your help...