Re: Exec format error
by Utilitarian (Vicar) on Dec 03, 2010 at 08:59 UTC
|
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."
| [reply] [d/l] |
|
Judging by what's in the file, it looks like test.html is meant to be executed...
| [reply] [d/l] |
|
What he showed isn't test.html. "test.html is in the same directory as the perl script."
| [reply] |
|
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... | [reply] [d/l] |
|
| [reply] |
|
<Directory "mydir/tools/cgi-bin">
^
I think the directory specification here needs to be a full (absolute) path in the filesystem. See <Directory>.
| [reply] [d/l] |
|
|
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...
| [reply] [d/l] |
|
Re: Exec format error
by marto (Cardinal) on Dec 03, 2010 at 09:42 UTC
|
| [reply] |
Re: Exec format error
by Anonymous Monk on Dec 03, 2010 at 08:40 UTC
|
| [reply] [d/l] |
|
Yes, the "--" on the shebang line is a nice trick to deal with potential trailing \rs.
It isn't going to help here though, as the problem isn't that the script itself doesn't run, but rather that the webserver is also trying to execute another (non-script) file "test.html" in the same directory - which is just a webserver configuration issue.
| [reply] [d/l] |
Re: Exec format error
by roc (Sexton) on Dec 03, 2010 at 11:50 UTC
|
if test.html is a pure html file the keep it under the html directory(/var/www/html)....or else try to specify the file with path.
| [reply] |