You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jim Hadfield <jh...@oldihc.org> on 2002/04/09 04:08:13 UTC

cgi question

Having just come from and  NT running to Xitami to TurboLinux running
Apache, I have a question.

How do I configure apache to run cgi-bin both in the directory of the
virtual domain and in the root of the system.  ie,
www.something.com/cgi-bin/ which translates to
var/www/html/something/cgi-bin while still using the default cgi-bin at
var/www/cgi-bin.  Or, can I just run the cgi-bin in the domain directory
where it is needed?? ie: var/www/html/something/cgi-bin

I ran it that way under Xitami with no problems.  But moving over the
Apache, a lot of things are totally different.

Jim Hadfield
SnowbankIH
20785 County Road 11
Big Lake, MN  55309

phone:  763-263-3806
fax:  801-751-3438
web site:  http://www.snowbankih.tzo.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: cgi question

Posted by Jim Hadfield <jh...@oldihc.org>.
Owen,

Exactly what I was looking for!!  Thanks!!

Jim


> -----Original Message-----
> It sounds like you are using method (2). If so, you can have as many
> ScriptAlias directives as you like. So you can have:
> 
> ScriptAlias /cgi-bin  /var/www/html/something/cgi-bin
> ScriptAlias /more-cgi /var/www/cgi-bin
> 
> then:
> 
> http://servername/cgi-bin/foo  -> /var/www/html/something/cgi-bin/foo
> http://servername/more-cgi/bar -> /var/www/cgi-bin/bar
> 
> NB: You have to use a different alias for each CGI directory.
> 

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Hasanuddin Tamir <sa...@trabas.com>.
On Tue, 9 Apr 2002, Admin <ko...@naisp.net> wrote,

> very good...THAT was going to be my next statement...as to what the error was...
> thats why I asked to see the script (itself) and his httpd.conf files.
> I suspected as that might be the problem.

Actually, Owen has spotted the problem and suggested correction.
I only followed his suggestion, which is right from the start.


-- 
san->http(www.trabas.com)
{If Linux doesn't have solution, you have the wrong problem}


> Hasanuddin Tamir wrote:
>
> > On Tue, 9 Apr 2002, Admin <ko...@naisp.net> wrote,
> >
> > > and thats why I also respoded in this way...
> > >
> > > 8)Exec format error:  < this tells me...that what I said about the space being
> > > inserted, (due to html editors etc)  could be the problem...I've had that happen to me
> > > on numerous occaisions....finally resorted to using either notepad, or a wonderful
> > > free html editor called Arachnophilia
> > >
> > > in a previous email/post...I also suggested that perhaps his permissions were incorrect
> >
> > Frankly, this is the first time I know there's such error, "Exec format
> > error".  I think I know what kind of error I would encounter should the
> > problem had something to do with configuration, so I did a little
> > experience.
> >
> > First, I created a little script called hello.cgi.
> >
> >     $ cat hello.cgi
> >     #!/usr/bin/perl
> >
> >     print "Content-type: text/html\n\n",
> >     "hello, world\n";
> >
> >     $ ./hello.cgi
> >     Content-type: text/html
> >
> >     hello, world
> >
> > I accessed the URL http://localhost/cgi-bin/hello.cgi and my browser
> > displayed the same content as expected. I then took away the # character
> > from the first line, and now I got internal server error. And the error log
> > says,
> >
> >     [Tue Apr  9 22:40:29 2002] [error] (8)Exec format error: exec of
> >     /usr/local/apache/cgi-bin/hello.cgi failed
> >
> > Btw, I hear somebody writes perl script with html editor and that causes
> > misplaced space?
> >
> > --
> > san->http(www.trabas.com)
> > {If Linux doesn't have solution, you have the wrong problem}
> >
> > >
> > > Owen Boyle wrote:
> > >
> > > > Admin wrote:
> > > > >
> > > > > yes...it's odd...only if you have failed to add the handler/ext " .pl " to that line
> > > > > DUHHHHH   and THATS exactly why...he is getting the error...
> > > > > look again at the extension on the filename...it is:  "cart.pl"
> > > > > not cart.cgi
> > > >
> > > > Look at the error message. This is not what happens if you make the
> > > > mistake you are describing.
> > > >
> > > > > [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> > > > > /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed
> > > >
> > > > As I stated in a direct reply, this is caused bby a faulty shebang line
> > > > trapping a system error.
> > > >
> > > > If you request a file which is supposed to be a CGI but you haven't
> > > > defined it as a CGI with AddHandler or ScriptAlias, apache will assume
> > > > it is a plain file and simply serve it so the client will just get the
> > > > perl script in his browser. You will not get an "Exec format error".
> > > >
> > > > There's no need to get all hot under the collar - we're all trying to
> > > > help one another here!
> > > >
> > > > Rgds,
> > > >
> > > > Owen Boyle.
> > > >
> > > > ---------------------------------------------------------------------
> > > > 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
> > > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
> > > --
> > > <******** http://www.myispnet.net ********>
> > > Admin -  My ISP Network
> > > admin@myispnet.net
> > > ICQ# 7110071
> > > MSN Messenger= myispnet@hotmail.com
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > > 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
> > For additional commands, e-mail: users-help@httpd.apache.org
>
> --
> <******** http://www.myispnet.net ********>
> Admin -  My ISP Network
> admin@myispnet.net
> ICQ# 7110071
> MSN Messenger= myispnet@hotmail.com
>
>
>
> ---------------------------------------------------------------------
> 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
> 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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Admin <ko...@naisp.net>.
very good...THAT was going to be my next statement...as to what the error was...
thats why I asked to see the script (itself) and his httpd.conf files.
I suspected as that might be the problem.

Hasanuddin Tamir wrote:

> On Tue, 9 Apr 2002, Admin <ko...@naisp.net> wrote,
>
> > and thats why I also respoded in this way...
> >
> > 8)Exec format error:  < this tells me...that what I said about the space being
> > inserted, (due to html editors etc)  could be the problem...I've had that happen to me
> > on numerous occaisions....finally resorted to using either notepad, or a wonderful
> > free html editor called Arachnophilia
> >
> > in a previous email/post...I also suggested that perhaps his permissions were incorrect
>
> Frankly, this is the first time I know there's such error, "Exec format
> error".  I think I know what kind of error I would encounter should the
> problem had something to do with configuration, so I did a little
> experience.
>
> First, I created a little script called hello.cgi.
>
>     $ cat hello.cgi
>     #!/usr/bin/perl
>
>     print "Content-type: text/html\n\n",
>     "hello, world\n";
>
>     $ ./hello.cgi
>     Content-type: text/html
>
>     hello, world
>
> I accessed the URL http://localhost/cgi-bin/hello.cgi and my browser
> displayed the same content as expected. I then took away the # character
> from the first line, and now I got internal server error. And the error log
> says,
>
>     [Tue Apr  9 22:40:29 2002] [error] (8)Exec format error: exec of
>     /usr/local/apache/cgi-bin/hello.cgi failed
>
> Btw, I hear somebody writes perl script with html editor and that causes
> misplaced space?
>
> --
> san->http(www.trabas.com)
> {If Linux doesn't have solution, you have the wrong problem}
>
> >
> > Owen Boyle wrote:
> >
> > > Admin wrote:
> > > >
> > > > yes...it's odd...only if you have failed to add the handler/ext " .pl " to that line
> > > > DUHHHHH   and THATS exactly why...he is getting the error...
> > > > look again at the extension on the filename...it is:  "cart.pl"
> > > > not cart.cgi
> > >
> > > Look at the error message. This is not what happens if you make the
> > > mistake you are describing.
> > >
> > > > [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> > > > /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed
> > >
> > > As I stated in a direct reply, this is caused bby a faulty shebang line
> > > trapping a system error.
> > >
> > > If you request a file which is supposed to be a CGI but you haven't
> > > defined it as a CGI with AddHandler or ScriptAlias, apache will assume
> > > it is a plain file and simply serve it so the client will just get the
> > > perl script in his browser. You will not get an "Exec format error".
> > >
> > > There's no need to get all hot under the collar - we're all trying to
> > > help one another here!
> > >
> > > Rgds,
> > >
> > > Owen Boyle.
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > > For additional commands, e-mail: users-help@httpd.apache.org
> >
> > --
> > <******** http://www.myispnet.net ********>
> > Admin -  My ISP Network
> > admin@myispnet.net
> > ICQ# 7110071
> > MSN Messenger= myispnet@hotmail.com
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
> > 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
> For additional commands, e-mail: users-help@httpd.apache.org

--
<******** http://www.myispnet.net ********>
Admin -  My ISP Network
admin@myispnet.net
ICQ# 7110071
MSN Messenger= myispnet@hotmail.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Hasanuddin Tamir <sa...@trabas.com>.
On Tue, 9 Apr 2002, Hasanuddin Tamir <sa...@trabas.com> wrote,

> Frankly, this is the first time I know there's such error, "Exec format
> error".  I think I know what kind of error I would encounter should the
> problem had something to do with configuration, so I did a little
> experience.
  ^^^^^^^^^^

Oops, I mean 'experiment.

Sorry.


-- 
san->http(www.trabas.com)
{If Linux doesn't have solution, you have the wrong problem}



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Hasanuddin Tamir <sa...@trabas.com>.
On Tue, 9 Apr 2002, Admin <ko...@naisp.net> wrote,

> and thats why I also respoded in this way...
>
> 8)Exec format error:  < this tells me...that what I said about the space being
> inserted, (due to html editors etc)  could be the problem...I've had that happen to me
> on numerous occaisions....finally resorted to using either notepad, or a wonderful
> free html editor called Arachnophilia
>
> in a previous email/post...I also suggested that perhaps his permissions were incorrect

Frankly, this is the first time I know there's such error, "Exec format
error".  I think I know what kind of error I would encounter should the
problem had something to do with configuration, so I did a little
experience.

First, I created a little script called hello.cgi.

    $ cat hello.cgi
    #!/usr/bin/perl

    print "Content-type: text/html\n\n",
    "hello, world\n";

    $ ./hello.cgi
    Content-type: text/html

    hello, world

I accessed the URL http://localhost/cgi-bin/hello.cgi and my browser
displayed the same content as expected. I then took away the # character
from the first line, and now I got internal server error. And the error log
says,

    [Tue Apr  9 22:40:29 2002] [error] (8)Exec format error: exec of
    /usr/local/apache/cgi-bin/hello.cgi failed


Btw, I hear somebody writes perl script with html editor and that causes
misplaced space?


-- 
san->http(www.trabas.com)
{If Linux doesn't have solution, you have the wrong problem}

>
> Owen Boyle wrote:
>
> > Admin wrote:
> > >
> > > yes...it's odd...only if you have failed to add the handler/ext " .pl " to that line
> > > DUHHHHH   and THATS exactly why...he is getting the error...
> > > look again at the extension on the filename...it is:  "cart.pl"
> > > not cart.cgi
> >
> > Look at the error message. This is not what happens if you make the
> > mistake you are describing.
> >
> > > [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> > > /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed
> >
> > As I stated in a direct reply, this is caused bby a faulty shebang line
> > trapping a system error.
> >
> > If you request a file which is supposed to be a CGI but you haven't
> > defined it as a CGI with AddHandler or ScriptAlias, apache will assume
> > it is a plain file and simply serve it so the client will just get the
> > perl script in his browser. You will not get an "Exec format error".
> >
> > There's no need to get all hot under the collar - we're all trying to
> > help one another here!
> >
> > Rgds,
> >
> > Owen Boyle.
> >
> > ---------------------------------------------------------------------
> > 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
> > For additional commands, e-mail: users-help@httpd.apache.org
>
> --
> <******** http://www.myispnet.net ********>
> Admin -  My ISP Network
> admin@myispnet.net
> ICQ# 7110071
> MSN Messenger= myispnet@hotmail.com
>
>
>
> ---------------------------------------------------------------------
> 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
> 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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Admin <ko...@naisp.net>.
and thats why I also respoded in this way...

8)Exec format error:  < this tells me...that what I said about the space being
inserted, (due to html editors etc)  could be the problem...I've had that happen to me
on numerous occaisions....finally resorted to using either notepad, or a wonderful
free html editor called Arachnophilia

in a previous email/post...I also suggested that perhaps his permissions were incorrect

Owen Boyle wrote:

> Admin wrote:
> >
> > yes...it's odd...only if you have failed to add the handler/ext " .pl " to that line
> > DUHHHHH   and THATS exactly why...he is getting the error...
> > look again at the extension on the filename...it is:  "cart.pl"
> > not cart.cgi
>
> Look at the error message. This is not what happens if you make the
> mistake you are describing.
>
> > [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> > /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed
>
> As I stated in a direct reply, this is caused bby a faulty shebang line
> trapping a system error.
>
> If you request a file which is supposed to be a CGI but you haven't
> defined it as a CGI with AddHandler or ScriptAlias, apache will assume
> it is a plain file and simply serve it so the client will just get the
> perl script in his browser. You will not get an "Exec format error".
>
> There's no need to get all hot under the collar - we're all trying to
> help one another here!
>
> Rgds,
>
> Owen Boyle.
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org

--
<******** http://www.myispnet.net ********>
Admin -  My ISP Network
admin@myispnet.net
ICQ# 7110071
MSN Messenger= myispnet@hotmail.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Owen Boyle <ob...@bourse.ch>.
Admin wrote:
> 
> yes...it's odd...only if you have failed to add the handler/ext " .pl " to that line
> DUHHHHH   and THATS exactly why...he is getting the error...
> look again at the extension on the filename...it is:  "cart.pl"
> not cart.cgi

Look at the error message. This is not what happens if you make the
mistake you are describing. 

> [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed

As I stated in a direct reply, this is caused bby a faulty shebang line
trapping a system error.

If you request a file which is supposed to be a CGI but you haven't
defined it as a CGI with AddHandler or ScriptAlias, apache will assume
it is a plain file and simply serve it so the client will just get the
perl script in his browser. You will not get an "Exec format error".

There's no need to get all hot under the collar - we're all trying to
help one another here!

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Admin <ko...@naisp.net>.
yes...it's odd...only if you have failed to add the handler/ext " .pl " to that line
DUHHHHH   and THATS exactly why...he is getting the error...
look again at the extension on the filename...it is:  "cart.pl"
not cart.cgi

Owen Boyle wrote:

> Admin wrote:
> >
> > you didn't understand what I said...presumably.
> >
> > YES addhandler DOES have a default that is setup...
> > when you install apache its default extension that is
> > (by default) setup is files with the " .cgi " extension ONLY.
> >
> > I only asked if he had also added the ext " .pl " to the addhandler line?
> > Just in case his script that was giving him trouble, had that ext.
> > if you don't specify this ext in that line as well, scipts with that ext will NOT
> > work.
> > aparently YOU are not aware of this, and therefore the reason you replied thusly.
>
> I understood you perfectly and you gave sound advice for someone who is
> having trouble using AddHandler. However, the questioner already said he
> was using ScriptAlias so advice re AddHandler is orthogonal and could be
> confusing.
>
> I am interested to learn that AddHandler (which is general directive)
> has a default. If so, it is not documented... Anyway, his error is:
>
> > [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> > /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed
>
> which is a funny one.
>
> > to the questioner:
>
> What happens when you execute the program from the command line?
>
> e.g.
>
> $ cd /var/www/html/snowbankih/cgi-bin/ihcparts
> $ ./cart.pl
>
> Rgds,
>
> Owen Boyle.
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org

--
<******** http://www.myispnet.net ********>
Admin -  My ISP Network
admin@myispnet.net
ICQ# 7110071
MSN Messenger= myispnet@hotmail.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: cgi question

Posted by Jim Hadfield <jh...@oldihc.org>.
Owen,

never tried that one, but will tonight.  gotta get out of here to the part
time job...
thank you and I will let you know what happens.

Jim


> -----Original Message-----
> What happens when you execute the program from the command line?
>
> e.g.
>
> $ cd /var/www/html/snowbankih/cgi-bin/ihcparts
> $ ./cart.pl


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Owen Boyle <ob...@bourse.ch>.
Admin wrote:
> 
> you didn't understand what I said...presumably.
> 
> YES addhandler DOES have a default that is setup...
> when you install apache its default extension that is
> (by default) setup is files with the " .cgi " extension ONLY.
> 
> I only asked if he had also added the ext " .pl " to the addhandler line?
> Just in case his script that was giving him trouble, had that ext.
> if you don't specify this ext in that line as well, scipts with that ext will NOT
> work.
> aparently YOU are not aware of this, and therefore the reason you replied thusly.

I understood you perfectly and you gave sound advice for someone who is
having trouble using AddHandler. However, the questioner already said he
was using ScriptAlias so advice re AddHandler is orthogonal and could be
confusing. 

I am interested to learn that AddHandler (which is general directive)
has a default. If so, it is not documented... Anyway, his error is: 

> [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed

which is a funny one. 

> to the questioner:

What happens when you execute the program from the command line?

e.g.

$ cd /var/www/html/snowbankih/cgi-bin/ihcparts
$ ./cart.pl

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Admin <ko...@naisp.net>.
you didn't understand what I said...presumably.

YES addhandler DOES have a default that is setup...
when you install apache its default extension that is
(by default) setup is files with the " .cgi " extension ONLY.

I only asked if he had also added the ext " .pl " to the addhandler line?
Just in case his script that was giving him trouble, had that ext.
if you don't specify this ext in that line as well, scipts with that ext will NOT
work.
aparently YOU are not aware of this, and therefore the reason you replied thusly.

Owen Boyle wrote:

> Admin wrote:
> >
> > When you included/uncommented the
> >
> > addhandler cgiscripts  .cgi   <did you also include the ext " .pl " ?
> >
> > you see, as default, apache only has " .cgi " ext included, you need to
> > manually include
> > also the  " .pl " ext as well, cause not all scripts are cgi, they also are pl
>
> "AddHandler" has no defaults at all. In any case, the questioner is not
> using "AddHandler" - he is using ScriptAlias to define CGIs. Therefore
> there is no need to use any particular extension.
>
> Rgds,
>
> Owen Boyle
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org

--
<******** http://www.myispnet.net ********>
Admin -  My ISP Network
admin@myispnet.net
ICQ# 7110071
MSN Messenger= myispnet@hotmail.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Owen Boyle <ob...@bourse.ch>.
Jim Hadfield wrote:
> 
> As mentioned before, I did try it with addhandler configured the way you
> suggested.
>     # To use CGI scripts:
>     #
>     AddHandler cgi-script .cgi .pl
> 
> Now, i just changed the script from:
> !/usr/bin/perl5
> 
> to this:
> !/usr/bin/perl
> 
> Run it and get this: (same error as before)
> [Tue Apr  9 09:25:56 2002] [error] (8)Exec format error: exec of
> /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed

This is a system error (see /usr/include/sys/errno.h) and is called when
your script doesn't begin with the correct shebang line.

Try setting the first line to:

#!/usr/bin/perl 

and it should work (well, it will execute... you might still have a
program failure but at least the system will execute it).

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: cgi question

Posted by Jim Hadfield <jh...@oldihc.org>.
As mentioned before, I did try it with addhandler configured the way you
suggested.
    # To use CGI scripts:
    #
    AddHandler cgi-script .cgi .pl

Now, i just changed the script from:
!/usr/bin/perl5

to this:
!/usr/bin/perl

Run it and get this: (same error as before)
[Tue Apr  9 09:25:56 2002] [error] (8)Exec format error: exec of
/var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed

Jim


> -----Original Message-----

> you see...I told you...THAT is the problem...you didnot add the handler /
> extension " .pl "
> to that line...do it and it will work...
> also I believe (but not sure) that your path to perl is incorrect...
> it should be ( usr/bin/perl)     not perl5  that is IF you're
> using unix/linux
>


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Admin <ko...@naisp.net>.
you see...I told you...THAT is the problem...you didnot add the handler /
extension " .pl "
to that line...do it and it will work...
also I believe (but not sure) that your path to perl is incorrect...
it should be ( usr/bin/perl)     not perl5  that is IF you're using unix/linux

Jim Hadfield wrote:

> Owen,
>
> Correct.  But, I did change the addhandler just now to give it a shot.
> Still got the same error..
> [Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
> /var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed
>
> perl is set up and at usr/bin/perl5
>
> Jim
>
> > -----Original Message-----
>
> >
> > "AddHandler" has no defaults at all. In any case, the questioner is not
> > using "AddHandler" - he is using ScriptAlias to define CGIs. Therefore
> > there is no need to use any particular extension.
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org

--
<******** http://www.myispnet.net ********>
Admin -  My ISP Network
admin@myispnet.net
ICQ# 7110071
MSN Messenger= myispnet@hotmail.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: cgi question

Posted by Jim Hadfield <jh...@oldihc.org>.
Owen,

Correct.  But, I did change the addhandler just now to give it a shot.
Still got the same error..
[Tue Apr  9 08:42:50 2002] [error] (8)Exec format error: exec of
/var/www/html/snowbankih/cgi-bin/ihcparts/cart.pl failed

perl is set up and at usr/bin/perl5

Jim


> -----Original Message-----

>
> "AddHandler" has no defaults at all. In any case, the questioner is not
> using "AddHandler" - he is using ScriptAlias to define CGIs. Therefore
> there is no need to use any particular extension.


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Owen Boyle <ob...@bourse.ch>.
Admin wrote:
> 
> When you included/uncommented the
> 
> addhandler cgiscripts  .cgi   <did you also include the ext " .pl " ?
> 
> you see, as default, apache only has " .cgi " ext included, you need to
> manually include
> also the  " .pl " ext as well, cause not all scripts are cgi, they also are pl

"AddHandler" has no defaults at all. In any case, the questioner is not
using "AddHandler" - he is using ScriptAlias to define CGIs. Therefore
there is no need to use any particular extension.

Rgds,

Owen Boyle

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Admin <ko...@naisp.net>.
When you included/uncommented the

addhandler cgiscripts  .cgi   <did you also include the ext " .pl " ?

you see, as default, apache only has " .cgi " ext included, you need to
manually include
also the  " .pl " ext as well, cause not all scripts are cgi, they also are pl

Jim Hadfield wrote:

> Owen,
>
> This did the trick.  Now to find out why my perl script is failing...
> Oh well, one thing after another.
>
> Jim
>
> > -----Original Message-----
>
> >
> > >     ScriptAlias /cgi-bin  /var/www/cgi-bin
> > >     ScriptAlias /cgi-snow /var/www/html/snowbankih/cgi-bin
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org

--
<******** http://www.myispnet.net ********>
Admin -  My ISP Network
admin@myispnet.net
ICQ# 7110071
MSN Messenger= myispnet@hotmail.com



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: cgi question

Posted by Jim Hadfield <jh...@oldihc.org>.
Owen,

This did the trick.  Now to find out why my perl script is failing...
Oh well, one thing after another.

Jim 


> -----Original Message-----

> 
> >     ScriptAlias /cgi-bin  /var/www/cgi-bin
> >     ScriptAlias /cgi-snow /var/www/html/snowbankih/cgi-bin


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Owen Boyle <ob...@bourse.ch>.
Jim Hadfield wrote:
> 
> Owen,
> 
> So, I presume the correct structure is like this:
> 
>     ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
>     ScriptAlias /cgi-bin  "/var/www/html/snowbankih/cgi-bin/"

Close - but you can't have "cgi-bin" twice as a ScriptAlias. The way you
have it, how is apache supposed to know which directory to look in for a
CGI program?

A couple of stylistic notes:
- In some contexts, a trailing-slash causes problems. So I don't have to
remember when I can and can't use it, I systematically *never* use a
trailing-slash in the config. It is never *required*. 
- quotes are optional too, I avoid them for readability.

So something like:

>     ScriptAlias /cgi-bin  /var/www/cgi-bin
>     ScriptAlias /cgi-snow /var/www/html/snowbankih/cgi-bin

would be better.

> 
>     #
>     # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
>     # CGI directory exists, if you have that configured.
>     #
>     <Directory "/var/www/html/snowbankih/cgi-bin">
>         AllowOverride None
>         Options None
>         Order allow,deny
>         Allow from all
>     </Directory>

Don't put "Options None". That will defeat "Options ExecCGI" which is on
by default and thus disable CGIs. Do you have a reason for this
directive? If you want to suppress a particular function, it's better to
do so explicitly, e.g. "Options -Indexes" to suppress directory
indexing.

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: cgi question

Posted by Jim Hadfield <jh...@oldihc.org>.
Owen,

So, I presume the correct structure is like this:

    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
    ScriptAlias /cgi-bin  "/var/www/html/snowbankih/cgi-bin/"

    #
    # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    #
    <Directory "/var/www/html/snowbankih/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>

Again, thank you.

Jim  

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: cgi question

Posted by Owen Boyle <ob...@bourse.ch>.
Jim Hadfield wrote:
> 
> Having just come from and  NT running to Xitami to TurboLinux running
> Apache, I have a question.
> 
> How do I configure apache to run cgi-bin both in the directory of the
> virtual domain and in the root of the system.  ie,
> www.something.com/cgi-bin/ which translates to
> var/www/html/something/cgi-bin while still using the default cgi-bin at
> var/www/cgi-bin.  Or, can I just run the cgi-bin in the domain directory
> where it is needed?? ie: var/www/html/something/cgi-bin

You can define CGIs in two ways:

1) File-based:

    AddHandler cgi-script cgi

now any file anywhere which ends in "cgi" will be treated as a CGI
script (i.e. apache will try to execute it, rather than serving it).

2) Directory-based:

   ScriptAlias /cgi-bin /web/cgi-bin

Now any ref to http://servername/cgi-bin/foo will be routed to
/web/cgi-bin/foo and apache will try to execute it. This is true for any
file in /web/cgi-bin, regardless of its extension.

It sounds like you are using method (2). If so, you can have as many
ScriptAlias directives as you like. So you can have:

ScriptAlias /cgi-bin  /var/www/html/something/cgi-bin
ScriptAlias /more-cgi /var/www/cgi-bin

then:

http://servername/cgi-bin/foo  -> /var/www/html/something/cgi-bin/foo
http://servername/more-cgi/bar -> /var/www/cgi-bin/bar

NB: You have to use a different alias for each CGI directory.

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org