[error](2) No such file or directory: exec of file
/usr/local/www/cgi-bin/first.pl failed
[error] [client 192.168.0.2] Premature end of script headers:
/usr/local/www/cgi-bin/first.pl
However, when I do:
/usr/bin/perl /usr/local/www/cgi-bin/first.pl
from the command line, the script runs fine.
The script first.pl looks like this:
#!/usr/bin/perl
print "Content Type: text/html\n\r\n\r";
print "Hello, World!";
I checked the rest of the Apache documentation and can find nothing
that I have configured wrong. scriptalias is setup correctly in
httpd.conf, and /usr/bin/perl is the correct path to the interpreter.
Please let me know what could be going wrong here.
Thank you,
Doug.
--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.
HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html
>[error](2) No such file or directory: exec of file
>/usr/local/www/cgi-bin/first.pl failed
>[error] [client 192.168.0.2] Premature end of script headers:
>/usr/local/www/cgi-bin/first.pl
>
>
>However, when I do:
>
>/usr/bin/perl /usr/local/www/cgi-bin/first.pl
>
>from the command line, the script runs fine.
>
>
>The script first.pl looks like this:
>
>#!/usr/bin/perl
>print "Content Type: text/html\n\r\n\r";
>print "Hello, World!";
If you used a Windows text editing program to create the
script, it may contain carriage return (<CR>) characters
at the end of each line
If this is the case, the 'No such file or directory' error
is caused by the <CR> at the end of the first line:
#!/usr/bin/perl<CR>
If you are using a Windows text editor, you can usually
solve this problem by ensuring that your ftp program
uploads the file using ASCII mode (not BINARY). ASCII mode
FTP transfers will remove the <CR> character from the end
of each line
Alternatively, get a text editor which saves text files in
Unix format. Programmers File Editor is free:
http://www.lancs.ac.uk/people/cpaap/pfe/
--
Sharon
> when following the directions in the Apache Documentation regarding
> CGI scripts I am having a problem. I wrote the first.pl script it
> describes,
You seem to be working from
http://httpd.apache.org/docs/howto/cgi.html
(it's always nicer if you can be explicit)
> placed it in the proper directory and modified the file
> permissions so I no longer got the forbidden message when trying to
> request the script.
> Now however I get the following 2 error messages
> from httpd-errors.log:
>
> [error](2) No such file or directory: exec of file
^^^^^^^^^^^^^^^^^^^^^^^^^ something wrong here
> /usr/local/www/cgi-bin/first.pl failed
> [error] [client 192.168.0.2] Premature end of script headers:
-> that's probably a knock-on effect. Look for the first problem
first.
> However, when I do:
>
> /usr/bin/perl /usr/local/www/cgi-bin/first.pl
>
> from the command line, the script runs fine.
This isn't the real test, though. You should be able to demonstrate
that you can execute the script by hand directly as
/usr/local/www/cgi-bin/first.pl
without prefixing it with the name of the perl interpreter.
> The script first.pl looks like this:
>
> #!/usr/bin/perl
> print "Content Type: text/html\n\r\n\r";
er, no, it doesn't. Look at the original again. But that isn't the
specific problem.
> I checked the rest of the Apache documentation and can find nothing
> that I have configured wrong. scriptalias is setup correctly in
> httpd.conf, and /usr/bin/perl is the correct path to the interpreter.
>
> Please let me know what could be going wrong here.
If you're mixing Windows and unix, it seems possible that you have a
stray carriage-return on the shebang line. Try putting the -w option
on it, like
#!/usr/bin/perl -w
and try the various tests again.
If that does the trick, somebody else can explain what's behind it.
"rende" <bubble...@hotmail.com> wrote in message
news:45372029.02121...@posting.google.com...
"rende" <bubble...@hotmail.com> wrote in message
news:45372029.02121...@posting.google.com...