Re: [EMAIL PROTECTED] OpenBSD 4.1 CGI issues

2007-08-23 Thread Tommy Nordgren


On 23 aug 2007, at 19.48, Israel Brewster wrote:

First off, I apologize for asking a question that I know you get a  
lot, but I have just spent the last hour and a half beating my head  
against the wall and searching the internet trying to find a  
solution with no luck.


Short version: I have an existing OpenBSD 4.0 box on which Apache  
(version 1.3.29) is working properly, including execution of CGI  
scripts. I am trying to move to a new machine with OpenBSD 4.1, so  
I started with a fresh OpenBSD 4.1 install, which comes with the  
same version of Apache as 4.0, and copied the httpd.conf file over  
from my old machine. After starting the web server, however, I  
found that it could not run any CGI scripts- always just giving me  
the following error:


[Thu Aug 23 08:45:40 2007] [error] [client 127.0.0.1] Premature end  
of script headers: /cgi-bin/test-cgi


The details: Aside from being OpenBSD 4.1, the new box is set up  
the same as the old one. I have checked and double checked the  
permissions on both the cgi files, including the test cgi included  
with the install, as well as the CGI folder. The test-cgi, as well  
as the printenv both run fine from a terminal window. I tried  
reverting to the factory default httpd.conf, with no luck. The  
permissions on the contents of the cgi-bin folder are as follows:


ls -l /var/www/cgi-bin/
total 212
--  1 root  bin 99072 Mar 10 16:41 bgplg
drwxr-xr-x  2 root  daemon512 Aug 23 07:59 nagios
-rwxrwxrwx  1 root  bin   268 Mar 10 16:32 printenv
-rwxrwxrwx  1 root  bin   757 Mar 10 16:32 test-cgi

the cgi-bin folder itself has 755 permissions. The relevant section  
from the httpd.conf file is as follows:


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

#
# "@@ServerRoot@@/cgi-bin" should be changed to whatever your  
ScriptAliased

# CGI directory exists, if you have that configured.
#

AllowOverride None
Options none
Order allow,deny
Allow from all


I have tried adding an "AddHandler cgi-script .cgi" directive to  
that block, as one webpage I found suggested, as well as changing  
the "Option none" to "Options ExecCGI". I did, of course, restart  
the server between each configuration change. I have also tried  
with various different CGI scripts, most of which come from a fresh  
install. Nothing seems to make any difference- I still get the  
"premature end of script headers" error. If this was linux, i'd say  
check the SELinux settings, but it isn't. What am I missing here?


---
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
---


	Are your CGI scripts written in Perl,Python, etc? Check that the  
path of the executables match

the shebang line!
--
What is a woman that you forsake her, and the hearth fire and the  
home acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the  
Dane women

Tommy Nordgren
[EMAIL PROTECTED]




-
The official User-To-User support forum of the Apache HTTP Server Project.
See http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [EMAIL PROTECTED] OpenBSD 4.1 CGI issues

2007-08-23 Thread Israel Brewster

On Aug 23, 2007, at 9:56 AM, Joshua Slive wrote:

On 8/23/07, Israel Brewster <[EMAIL PROTECTED]> wrote:

First off, I apologize for asking a question that I know you get a
lot, but I have just spent the last hour and a half beating my head
against the wall and searching the internet trying to find a solution
with no luck.

Short version: I have an existing OpenBSD 4.0 box on which Apache
(version 1.3.29) is working properly, including execution of CGI
scripts. I am trying to move to a new machine with OpenBSD 4.1, so I
started with a fresh OpenBSD 4.1 install, which comes with the same
version of Apache as 4.0, and copied the httpd.conf file over from my
old machine. After starting the web server, however, I found that it
could not run any CGI scripts- always just giving me the following
error:

[Thu Aug 23 08:45:40 2007] [error] [client 127.0.0.1] Premature end
of script headers: /cgi-bin/test-cgi


[...snip...]
But anyway, this problem is fairly standard and is addressed here:
http://httpd.apache.org/docs/1.3/howto/cgi.html#butitsstillnotworking


As I mentioned in the first line, I was aware of that fact, and had  
been searching the internet for a solution and trying different  
things for the last hour and a half before asking for help :-)




The error means that apache is perfectly happy to launch your CGI
script, but the CGI is failing in some way.

The first thing to try is running the CGI from the command line:
cd /path/to/cgi-bin
./test-cgi

Joshua.



[...snip...]
The test-cgi, as well as
the printenv both run fine from a terminal window.


Yep, as I also mentioned, tried that. Worked fine. I did manage to  
fix the problem though-turns out that the problem was with Apache  
being chrooted. The first line of the test script was looking for / 
bin/sh, which, when chrooted, Apache could not find. I thought I had  
checked this against my functioning box, but apparently I was looking  
at the wrong box or something. At any rate, un-chrooting Apache fixed  
the issue. Thanks for the help attempt!


---
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
---


I tried reverting
to the factory default httpd.conf, with no luck. The permissions on
the contents of the cgi-bin folder are as follows:

ls -l /var/www/cgi-bin/
total 212
--  1 root  bin 99072 Mar 10 16:41 bgplg
drwxr-xr-x  2 root  daemon512 Aug 23 07:59 nagios
-rwxrwxrwx  1 root  bin   268 Mar 10 16:32 printenv
-rwxrwxrwx  1 root  bin   757 Mar 10 16:32 test-cgi

the cgi-bin folder itself has 755 permissions. The relevant section
from the httpd.conf file is as follows:

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

 #
 # "@@ServerRoot@@/cgi-bin" should be changed to whatever your
ScriptAliased
 # CGI directory exists, if you have that configured.
 #
 
 AllowOverride None
 Options none
 Order allow,deny
 Allow from all
 

I have tried adding an "AddHandler cgi-script .cgi" directive to that
block, as one webpage I found suggested, as well as changing the
"Option none" to "Options ExecCGI". I did, of course, restart the
server between each configuration change. I have also tried with
various different CGI scripts, most of which come from a fresh
install. Nothing seems to make any difference- I still get the
"premature end of script headers" error. If this was linux, i'd say
check the SELinux settings, but it isn't. What am I missing here?

---
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
---



-
The official User-To-User support forum of the Apache HTTP Server  
Project.

See http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
The official User-To-User support forum of the Apache HTTP Server  
Project.

See http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
The official User-To-User support forum of the Apache HTTP Server Project.
See http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [EMAIL PROTECTED] OpenBSD 4.1 CGI issues

2007-08-23 Thread Dragon

Israel Brewster wrote:

First off, I apologize for asking a question that I know you get a
lot, but I have just spent the last hour and a half beating my head
against the wall and searching the internet trying to find a solution
with no luck.

Short version: I have an existing OpenBSD 4.0 box on which Apache
(version 1.3.29) is working properly, including execution of CGI
scripts. I am trying to move to a new machine with OpenBSD 4.1, so I
started with a fresh OpenBSD 4.1 install, which comes with the same
version of Apache as 4.0, and copied the httpd.conf file over from my
old machine. After starting the web server, however, I found that it
could not run any CGI scripts- always just giving me the following
error:

[Thu Aug 23 08:45:40 2007] [error] [client 127.0.0.1] Premature end
of script headers: /cgi-bin/test-cgi

The details: Aside from being OpenBSD 4.1, the new box is set up the
same as the old one. I have checked and double checked the
permissions on both the cgi files, including the test cgi included
with the install, as well as the CGI folder. The test-cgi, as well as
the printenv both run fine from a terminal window. I tried reverting
to the factory default httpd.conf, with no luck. The permissions on
the contents of the cgi-bin folder are as follows:

ls -l /var/www/cgi-bin/
total 212
--  1 root  bin 99072 Mar 10 16:41 bgplg
drwxr-xr-x  2 root  daemon512 Aug 23 07:59 nagios
-rwxrwxrwx  1 root  bin   268 Mar 10 16:32 printenv
-rwxrwxrwx  1 root  bin   757 Mar 10 16:32 test-cgi

the cgi-bin folder itself has 755 permissions. The relevant section
from the httpd.conf file is as follows:

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

#
# "@@ServerRoot@@/cgi-bin" should be changed to whatever your
ScriptAliased
# CGI directory exists, if you have that configured.
#

AllowOverride None
Options none
Order allow,deny
Allow from all


I have tried adding an "AddHandler cgi-script .cgi" directive to that
block, as one webpage I found suggested, as well as changing the
"Option none" to "Options ExecCGI". I did, of course, restart the
server between each configuration change. I have also tried with
various different CGI scripts, most of which come from a fresh
install. Nothing seems to make any difference- I still get the
"premature end of script headers" error. If this was linux, i'd say
check the SELinux settings, but it isn't. What am I missing here?

 End original message. -

Are you sure that this new version of BSD doesn't have something 
similar to selinux that may be blocking your access?


It sure matches the symptoms one gets when selinux is the culprit on 
a linux installation.


Dragon

~~~
 Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~


-
The official User-To-User support forum of the Apache HTTP Server Project.
See http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [EMAIL PROTECTED] OpenBSD 4.1 CGI issues

2007-08-23 Thread Joshua Slive
On 8/23/07, Israel Brewster <[EMAIL PROTECTED]> wrote:
> First off, I apologize for asking a question that I know you get a
> lot, but I have just spent the last hour and a half beating my head
> against the wall and searching the internet trying to find a solution
> with no luck.
>
> Short version: I have an existing OpenBSD 4.0 box on which Apache
> (version 1.3.29) is working properly, including execution of CGI
> scripts. I am trying to move to a new machine with OpenBSD 4.1, so I
> started with a fresh OpenBSD 4.1 install, which comes with the same
> version of Apache as 4.0, and copied the httpd.conf file over from my
> old machine. After starting the web server, however, I found that it
> could not run any CGI scripts- always just giving me the following
> error:
>
> [Thu Aug 23 08:45:40 2007] [error] [client 127.0.0.1] Premature end
> of script headers: /cgi-bin/test-cgi

It is always dangerous to give any advice about OpenBSD's apache,
because it is not true "apache.org" apache, but a hacked-up version
that was frozen in time years ago when Theo decided he didn't like the
Apache 2 License.

But anyway, this problem is fairly standard and is addressed here:
http://httpd.apache.org/docs/1.3/howto/cgi.html#butitsstillnotworking

The error means that apache is perfectly happy to launch your CGI
script, but the CGI is failing in some way.

The first thing to try is running the CGI from the command line:
cd /path/to/cgi-bin
./test-cgi

Joshua.

>
> The details: Aside from being OpenBSD 4.1, the new box is set up the
> same as the old one. I have checked and double checked the
> permissions on both the cgi files, including the test cgi included
> with the install, as well as the CGI folder. The test-cgi, as well as
> the printenv both run fine from a terminal window. I tried reverting
> to the factory default httpd.conf, with no luck. The permissions on
> the contents of the cgi-bin folder are as follows:
>
> ls -l /var/www/cgi-bin/
> total 212
> --  1 root  bin 99072 Mar 10 16:41 bgplg
> drwxr-xr-x  2 root  daemon512 Aug 23 07:59 nagios
> -rwxrwxrwx  1 root  bin   268 Mar 10 16:32 printenv
> -rwxrwxrwx  1 root  bin   757 Mar 10 16:32 test-cgi
>
> the cgi-bin folder itself has 755 permissions. The relevant section
> from the httpd.conf file is as follows:
>
>  ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
>
>  #
>  # "@@ServerRoot@@/cgi-bin" should be changed to whatever your
> ScriptAliased
>  # CGI directory exists, if you have that configured.
>  #
>  
>  AllowOverride None
>  Options none
>  Order allow,deny
>  Allow from all
>  
>
> I have tried adding an "AddHandler cgi-script .cgi" directive to that
> block, as one webpage I found suggested, as well as changing the
> "Option none" to "Options ExecCGI". I did, of course, restart the
> server between each configuration change. I have also tried with
> various different CGI scripts, most of which come from a fresh
> install. Nothing seems to make any difference- I still get the
> "premature end of script headers" error. If this was linux, i'd say
> check the SELinux settings, but it isn't. What am I missing here?
>
> ---
> Israel Brewster
> Computer Support Technician
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> ---
>
>
>
> -
> The official User-To-User support forum of the Apache HTTP Server Project.
> See http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: [EMAIL PROTECTED]
>"   from the digest: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
The official User-To-User support forum of the Apache HTTP Server Project.
See http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[EMAIL PROTECTED] OpenBSD 4.1 CGI issues

2007-08-23 Thread Israel Brewster
First off, I apologize for asking a question that I know you get a  
lot, but I have just spent the last hour and a half beating my head  
against the wall and searching the internet trying to find a solution  
with no luck.


Short version: I have an existing OpenBSD 4.0 box on which Apache  
(version 1.3.29) is working properly, including execution of CGI  
scripts. I am trying to move to a new machine with OpenBSD 4.1, so I  
started with a fresh OpenBSD 4.1 install, which comes with the same  
version of Apache as 4.0, and copied the httpd.conf file over from my  
old machine. After starting the web server, however, I found that it  
could not run any CGI scripts- always just giving me the following  
error:


[Thu Aug 23 08:45:40 2007] [error] [client 127.0.0.1] Premature end  
of script headers: /cgi-bin/test-cgi


The details: Aside from being OpenBSD 4.1, the new box is set up the  
same as the old one. I have checked and double checked the  
permissions on both the cgi files, including the test cgi included  
with the install, as well as the CGI folder. The test-cgi, as well as  
the printenv both run fine from a terminal window. I tried reverting  
to the factory default httpd.conf, with no luck. The permissions on  
the contents of the cgi-bin folder are as follows:


ls -l /var/www/cgi-bin/
total 212
--  1 root  bin 99072 Mar 10 16:41 bgplg
drwxr-xr-x  2 root  daemon512 Aug 23 07:59 nagios
-rwxrwxrwx  1 root  bin   268 Mar 10 16:32 printenv
-rwxrwxrwx  1 root  bin   757 Mar 10 16:32 test-cgi

the cgi-bin folder itself has 755 permissions. The relevant section  
from the httpd.conf file is as follows:


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

#
# "@@ServerRoot@@/cgi-bin" should be changed to whatever your  
ScriptAliased

# CGI directory exists, if you have that configured.
#

AllowOverride None
Options none
Order allow,deny
Allow from all


I have tried adding an "AddHandler cgi-script .cgi" directive to that  
block, as one webpage I found suggested, as well as changing the  
"Option none" to "Options ExecCGI". I did, of course, restart the  
server between each configuration change. I have also tried with  
various different CGI scripts, most of which come from a fresh  
install. Nothing seems to make any difference- I still get the  
"premature end of script headers" error. If this was linux, i'd say  
check the SELinux settings, but it isn't. What am I missing here?


---
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
---



-
The official User-To-User support forum of the Apache HTTP Server Project.
See http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]