You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Silvino C. Ferreira" <si...@devferr.com> on 2002/10/05 06:07:11 UTC
[users@httpd] Failure running CGI script using perl
I have set up Apache 1.3 on a Red Hat Linux 7.3. When I run a script
from cgi-bin (I am using the example from the documentation on the
apache web site [see below] ), I get:
"The server encountered an internal error or misconfiguration and was
unable to complete your request"
The script first.pl is as follows:
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "Hello, World.";
Looking at the /ect/httpd/logs/error_log I get the following 2 messages:
[error] (2)No such file or directory: exec of
/var/www/cgi-bin/first.pl
[error] [client 192.168.1.10] Premature end of script headers:
/var/www/cgi-bin/first.pl
If I am understanding this correctly, the html from the CGI script is
never being created. The first line seems to be telling me that Apache
can not find /usr/bin/perl.
I have checked the script by running it through the command
/etc/bin/perl first.pl
and it creates valid html.
I have verified that /usr/bin/perl does exist and that it has
permissions of 755.
Is there something I am missing? Any help would be appreciated.
Thanks.
Sil Ferreira
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Failure running CGI script using perl
Posted by "Silvino C. Ferreira" <si...@devferr.com>.
Zac;
Bingo! You were absolutely correct. I created the script at the linux machine
using a Linux editor and it worked just fine.
Thanks again!
Sil
Zac Stevens wrote:
> Hi Sil,
>
> On Sat, Oct 05, 2002 at 09:01:40AM -0400, Silvino C. Ferreira wrote:
> > Zac Stevens wrote:
> > > What happens when you run the script by typing:
> > >
> > > /var/www/cgi-bin/first.pl
> >
> > I get the following
> > : bad interpreter: No such file or directoryerl
> >
> > and yes their is a erl after the word directory.
>
> Okay, this is the cause of the problem - however it's very odd and I don't
> have a good answer for you!
>
> One possibility is that there are some bad control characters in your
> script. For example, if you create a file under Windows and then copy it
> to your unix machine, it may have broken line endings represented as '^M'
> in the file.
>
> For Apache to run your script as a CGI, you need to be able to run it by
> hand on the command line. Until the script works that way, it definitely
> will not run as a CGI.
>
> I hope this at least takes you a step closer to a solution.
>
> Cheers,
>
> Zac
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Failure running CGI script using perl
Posted by Zac Stevens <zt...@cryptocracy.com>.
Hi Sil,
On Sat, Oct 05, 2002 at 09:01:40AM -0400, Silvino C. Ferreira wrote:
> Zac Stevens wrote:
> > What happens when you run the script by typing:
> >
> > /var/www/cgi-bin/first.pl
>
> I get the following
> : bad interpreter: No such file or directoryerl
>
> and yes their is a erl after the word directory.
Okay, this is the cause of the problem - however it's very odd and I don't
have a good answer for you!
One possibility is that there are some bad control characters in your
script. For example, if you create a file under Windows and then copy it
to your unix machine, it may have broken line endings represented as '^M'
in the file.
For Apache to run your script as a CGI, you need to be able to run it by
hand on the command line. Until the script works that way, it definitely
will not run as a CGI.
I hope this at least takes you a step closer to a solution.
Cheers,
Zac
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Failure running CGI script using perl
Posted by Mitch Vincent <mi...@cfact.com>.
Erase the first like entirely and re-type it by hand.
You probably have some control characters in there or something.
>
> Any other suggestions?
>
> Thanks
>
> Sil
-Mitch
There are three kinds of people in this world. Those that can count and
those that can't.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Failure running CGI script using perl
Posted by "Silvino C. Ferreira" <si...@devferr.com>.
Hi Zac,
Zac Stevens wrote:
> Hi Silvino,
>
> On Sat, Oct 05, 2002 at 12:07:11AM -0400, Silvino C. Ferreira wrote:
> > I have checked the script by running it through the command
> > /etc/bin/perl first.pl
> > and it creates valid html.
> >
> > I have verified that /usr/bin/perl does exist and that it has
> > permissions of 755.
>
> I presume that's a typo above where you say /etc/bin/perl ?
Yes.
>
> Anyway, that part is immaterial as Apache does not invoke the CGI script
> in that way.
>
> What happens when you run the script by typing:
>
> /var/www/cgi-bin/first.pl
>
> at your command prompt?
I get the following
: bad interpreter: No such file or directoryerl
and yes their is a erl after the word directory.
> My first guess would be that you do not have
> execute permissions on the script. If that's the case,
>
> chmod 755 /var/www/cgi-bin/first.pl
I checked. Both /var/www/cgi-bin/first.pls and /usr/bin/perl are set to 755
Any other suggestions?
Thanks
Sil
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Failure running CGI script using perl
Posted by Zac Stevens <zt...@cryptocracy.com>.
Hi Silvino,
On Sat, Oct 05, 2002 at 12:07:11AM -0400, Silvino C. Ferreira wrote:
> I have checked the script by running it through the command
> /etc/bin/perl first.pl
> and it creates valid html.
>
> I have verified that /usr/bin/perl does exist and that it has
> permissions of 755.
I presume that's a typo above where you say /etc/bin/perl ?
Anyway, that part is immaterial as Apache does not invoke the CGI script
in that way.
What happens when you run the script by typing:
/var/www/cgi-bin/first.pl
at your command prompt? My first guess would be that you do not have
execute permissions on the script. If that's the case,
chmod 755 /var/www/cgi-bin/first.pl
will correct it.
HTH,
Zac
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org