| Author |
Running cgi scrips
|
|
| John Rusinko 2004-09-02, 8:47 pm |
| Help
I am trying to run some cgi scripts on my server and have no luck in
doing it. In my error logs I get "Premature end of script headers:" Any
Idea as to what is going wrong? I have these lines in my httpd.conf file:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
Addhandler cgi-script .cgi
The script files are executable
Is their something I have missed?
John
| |
| John Rusinko 2004-09-02, 8:47 pm |
| John Rusinko wrote:
> Help
>
> I am trying to run some cgi scripts on my server and have no luck in
> doing it. In my error logs I get "Premature end of script headers:" Any
> Idea as to what is going wrong? I have these lines in my httpd.conf file:
> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
> Addhandler cgi-script .cgi
>
> The script files are executable
>
> Is their something I have missed?
>
> John
>
OK, I have done some more digging, I have a small cgi script to just
test things out:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello";
That's it, nothing else. when I try to run this script from the command
line using the command /var/www/cgi-bin/test.pl I get ": bad
interpreter: No such file or directory/perl" If I check to see where
perl is on my system, it is in the directory /usr/bin/. I have also
added .pl to the Addhandler cgi-script in the config file.
Any Ideas??
John
| |
| Chris Morris 2004-09-02, 8:47 pm |
| John Rusinko <ponyxprs@rcn.com> writes:
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> print "Hello";
>
> That's it, nothing else. when I try to run this script from the
> command line using the command /var/www/cgi-bin/test.pl I get ": bad
> interpreter: No such file or directory/perl" If I check to see where
> PERL is on my system, it is in the directory /usr/bin/. I have also
> added .pl to the Addhandler cgi-script in the config file.
Did you write this script on a windows system and copy it over?
If so you may be trying to call /usr/bin/perl\r
--
Chris
| |
| John Rusinko 2004-09-02, 8:47 pm |
| Chris Morris wrote:
> John Rusinko <ponyxprs@rcn.com> writes:
>
>
>
> Did you write this script on a windows system and copy it over?
> If so you may be trying to call /usr/bin/perl\r
>
nope, used VI right from the console, what does the \r do?
| |
| Chris Morris 2004-09-02, 8:47 pm |
| John Rusinko <ponyxprs@rcn.com> writes:
> Chris Morris wrote:
> nope, used VI right from the console, what does the \r do?
Windows line ending is \r\n
So on a unix system expecting the line ending \n the path to the
interpreter assumes the \r as well.
What happens if you type 'perl /var/www/cgi-bin/test.pl' on the
command line?
--
Chris
| |
| John Rusinko 2004-09-02, 8:47 pm |
| Chris Morris wrote:
> John Rusinko <ponyxprs@rcn.com> writes:
>
>
>
> Windows line ending is \r\n
>
> So on a unix system expecting the line ending \n the path to the
> interpreter assumes the \r as well.
>
> What happens if you type 'perl /var/www/cgi-bin/test.pl' on the
> command line?
>
I get:
"Content-type: texl/html
Hello"
With out the quotes of course, could it be the the script does not know
how to find the PERL interpreter? Do I have to add something to a PATH
variable?
John
| |
| Chris Morris 2004-09-02, 8:47 pm |
| John Rusinko <ponyxprs@rcn.com> writes:
> Chris Morris wrote:
> [it works]
>
> With out the quotes of course, could it be the the script does not
> know how to find the PERL interpreter?
The error message looks like it's unable to find it, yes.
> Do I have to add something to a PATH variable?
Shouldn't do, you have an absolute path in the shebang line.
What does 'which perl' say? What are the file permissions of
/var/www/cgi-bin/test.pl and /usr/bin/perl?
--
Chris
| |
| John Rusinko 2004-09-02, 8:47 pm |
| Chris Morris wrote:
> John Rusinko <ponyxprs@rcn.com> writes:
>
>
>
> The error message looks like it's unable to find it, yes.
>
>
>
>
> Shouldn't do, you have an absolute path in the shebang line.
>
> What does 'which perl' say? What are the file permissions of
> /var/www/cgi-bin/test.pl and /usr/bin/perl?
>
which PERL says "/usr/bin/perl"
Permissions for both /var/www/cgi-bin/test.pl and /usr/bin/perl are
Owner: root
Group: root
Read: Owner, Group, Others
Write: Owner
Exec: Owner, Group, Others
| |
| Rusty Wright 2004-09-07, 8:47 pm |
| Does your apache run chrooted?
John Rusinko <ponyxprs@rcn.com> writes:
> Chris Morris wrote:
> which PERL says "/usr/bin/perl"
>
> Permissions for both /var/www/cgi-bin/test.pl and /usr/bin/perl are
>
> Owner: root
> Group: root
> Read: Owner, Group, Others
> Write: Owner
> Exec: Owner, Group, Others
| |
| Jonathan2s6 2004-09-12, 7:46 am |
| Redhat, Debian, FreeBSD, Windows
High Speed Servers with 1000GB Traffic.
starting at $85
http://www.globalregister.net
| |
| John Rusinko 2004-09-13, 7:47 am |
| Rusty Wright wrote:
> Does your apache run chrooted?
>
No it is not
| |
| ricky.ricardo@lucy.com 2004-09-15, 10:13 am |
| Rusty Wright <rusty@socrates.berkeley.edu> wrote:
: Does your apache run chrooted?
: John Rusinko <ponyxprs@rcn.com> writes:
:> Chris Morris wrote:
:> > John Rusinko <ponyxprs@rcn.com> writes:
:> >
:> >>Chris Morris wrote:
:> >>
:> >>>John Rusinko <ponyxprs@rcn.com> writes:
:> >>>
:> >>>>Chris Morris wrote:
:> >>>>
:> >>>>>John Rusinko <ponyxprs@rcn.com> writes:
:> >>>>>
:> >>>>>>#!/usr/bin/perl
:> >>>>>>print "Content-type: text/html\n\n";
:> >>>>>>print "Hello";
:> >>>>>>
:> >>>>>>That's it, nothing else. when I try to run this script from the
:> >>>>>>command line using the command /var/www/cgi-bin/test.pl I get ": bad
:> >>>>>>interpreter: No such file or directory/perl" If I check to see where
:> >>>
:> >>>What happens if you type 'perl /var/www/cgi-bin/test.pl' on the
:> >>>command line?
:> >>>
:> >>
:> >>[it works]
:> >>
:> >>With out the quotes of course, could it be the the script does not
:> >>know how to find the PERL interpreter?
:> >
:> >
:> > The error message looks like it's unable to find it, yes.
:> >
:> >
:> >>Do I have to add something to a PATH variable?
:> >
:> >
:> > Shouldn't do, you have an absolute path in the shebang line.
:> >
:> > What does 'which perl' say? What are the file permissions of
:> > /var/www/cgi-bin/test.pl and /usr/bin/perl?
:> >
:> which PERL says "/usr/bin/perl"
:>
:> Permissions for both /var/www/cgi-bin/test.pl and /usr/bin/perl are
:>
:> Owner: root
:> Group: root
:> Read: Owner, Group, Others
:> Write: Owner
:> Exec: Owner, Group, Others
Open the script in vi and use the ":set list" command to view non printing characters
Then look for ^M at the end of the first line. If it's there remove it.
----------------------------------------
"Mon aéroglisseur est plein d'anguilles"
John P. Dodge
Boeing Shared Services
| |
| P Buder 2004-09-23, 9:20 am |
| >>>>John Rusinko <ponyxprs@rcn.com> writes:
>I get:
>"Content-type: texl/html
>Hello"
If that is really a copy and paste of what you got, you need to fix the typo in
your code that says texl instead of text.
|
|
|
|