You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bob Bomar <bu...@fxp.org> on 2003/02/07 22:17:17 UTC

[users@httpd] CGI problem

I am running Apache 1.3.27 on a FreeBSD 4.7 Server. When I go to=20
/cgi-bin/ from the web, I get a 500 error.  When I run the script
from the command line, it works fine, with the header and all.
I checked my logs and I see this:

[Thu Feb  6 21:02:07 2003] [error] [client 192.168.1.13] Premature end of s=
cript headers: /dir/to/script/cvsweb.cgi
[Thu Feb  6 21:02:43 2003] [error] [client 192.168.1.13] Premature end of s=
cript headers: /dir/to/script/cvsweb.cgi
[Thu Feb  6 21:02:45 2003] [error] [client 192.168.1.13] Premature end of s=
cript headers: /dir/to/script/cvsweb.cgi

here is the relevent portion of the httpd.conf:

<VirtualHost *>
ServerAdmin bob@bomar.us
DocumentRoot /usr/local/www/bob
ServerName bob.bomar.us
ErrorLog /var/log/bob-error
CustomLog /var/log/bob-custom common
ScriptAlias /cgi-bin/ "/usr/local/www/bob/cgi-bin/"
#AddHandler cgi-script .cgi
#AddHandler cgi-script .pl
</VirtualHost>

-- 
/----------------------------------------------------------------\
| Bob Bomar 	bulldog@fxp.org 	http://www.bomar.us/~bob |
|================================================================|
| FreeBSD: The Power to Serve.		http://www.freeBSD.org   |
\----------------------------------------------------------------/

Re: [users@httpd] CGI problem

Posted by BAO RuiXian <ba...@atbusiness.com>.
Hello, Bob,

Bob Bomar wrote:
> 
> It works from the command line and from the apache running on my
> file server and my desktop, all running freebsd, but not from
> my web server.

Sorry Bob. Now I get a little confused. You said it works from the
apache, but then said again not working from your web server. Are the
apache and your web server not the same thing? To make things clear, do
you have two web servers (here equal to apache) respectively installed
on your own desktop and the server machine?

Best

Bao 
> --
> /----------------------------------------------------------------\
> | Bob Bomar     bulldog@fxp.org         http://www.bomar.us/~bob |
> |================================================================|

-- 
BAO RuiXian,  SOFTWARE ENGINEER,   Project Consulting,  Software
Services
AtBusiness Communications Corporation, Kaapeliaukio 1, FIN-00180
Helsinki
Telephone +358-9-2311 6674, Mobile +358-50-329 6275, Fax +358-9-2311
6601
Web: www.atbusiness.com, Email: {bao.ruixian,
ruixian.bao}@atbusiness.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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] CGI problem

Posted by Bob Bomar <bu...@fxp.org>.
On Sat, Feb 08, 2003 at 02:28:50AM +0200, BAO RuiXian wrote:
> 
> 
> Bob Bomar wrote:
> > 
> > On Sat, Feb 08, 2003 at 02:13:09AM +0200, BAO RuiXian wrote:
> > > Hello, Bob,
> > > > Yes, I do.  CVSWeb works on my desktop, but not on that machine.
> > >
> > > Does the above line mean that CVSWeb does not work from the command line
> > > on the server machine?
> > >
> > > Best
> > >
> > > Bao
> > 
> > It does work from the command line.
> 
> So, then it works both from the command line and via the browser on your
> desktop, and it works only from the command line but not via the browser
> on your server machine. Is this right?
> 
> Best
> 
> Bao

It works from the command line and from the apache running on my 
file server and my desktop, all running freebsd, but not from
my web server.

-- 
/----------------------------------------------------------------\
| Bob Bomar 	bulldog@fxp.org 	http://www.bomar.us/~bob |
|================================================================|
| FreeBSD: The Power to Serve.		http://www.freeBSD.org   |
\----------------------------------------------------------------/

Re: [users@httpd] CGI problem

Posted by BAO RuiXian <ba...@atbusiness.com>.

Bob Bomar wrote:
> 
> On Sat, Feb 08, 2003 at 02:13:09AM +0200, BAO RuiXian wrote:
> > Hello, Bob,
> > > Yes, I do.  CVSWeb works on my desktop, but not on that machine.
> >
> > Does the above line mean that CVSWeb does not work from the command line
> > on the server machine?
> >
> > Best
> >
> > Bao
> 
> It does work from the command line.

So, then it works both from the command line and via the browser on your
desktop, and it works only from the command line but not via the browser
on your server machine. Is this right?

Best

Bao

> --
> /----------------------------------------------------------------\
> | Bob Bomar     bulldog@fxp.org         http://www.bomar.us/~bob |
> |================================================================|

-- 
BAO RuiXian,  SOFTWARE ENGINEER,   Project Consulting,  Software
Services
AtBusiness Communications Corporation, Kaapeliaukio 1, FIN-00180
Helsinki
Telephone +358-9-2311 6674, Mobile +358-50-329 6275, Fax +358-9-2311
6601
Web: www.atbusiness.com, Email: {bao.ruixian,
ruixian.bao}@atbusiness.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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] CGI problem

Posted by Bob Bomar <bu...@fxp.org>.
On Sat, Feb 08, 2003 at 02:13:09AM +0200, BAO RuiXian wrote:
> Hello, Bob,
> 
> Bob Bomar wrote:
> > 
> > On Sat, Feb 08, 2003 at 01:49:59AM +0200, BAO RuiXian wrote:
> > > Hello,
> > >
> > > Do you have "Content-type: text/html" as your first output line when you
> > > run it successfully from the command line? Otherwise, it can also cause
> > > the exact following error "Premature end of script headers".
> > >
> > > Bao
> > >
> > > Best
> > >
> > 
> > Yes, I do.  CVSWeb works on my desktop, but not on that machine.
> 
> Does the above line mean that CVSWeb does not work from the command line
> on the server machine?
> 
> Best
> 
> Bao

It does work from the command line.

-- 
/----------------------------------------------------------------\
| Bob Bomar 	bulldog@fxp.org 	http://www.bomar.us/~bob |
|================================================================|
| FreeBSD: The Power to Serve.		http://www.freeBSD.org   |
\----------------------------------------------------------------/

Re: [users@httpd] CGI problem

Posted by BAO RuiXian <ba...@atbusiness.com>.
Hello, Bob,

Bob Bomar wrote:
> 
> On Sat, Feb 08, 2003 at 01:49:59AM +0200, BAO RuiXian wrote:
> > Hello,
> >
> > Do you have "Content-type: text/html" as your first output line when you
> > run it successfully from the command line? Otherwise, it can also cause
> > the exact following error "Premature end of script headers".
> >
> > Bao
> >
> > Best
> >
> 
> Yes, I do.  CVSWeb works on my desktop, but not on that machine.

Does the above line mean that CVSWeb does not work from the command line
on the server machine?

Best

Bao
> --
> /----------------------------------------------------------------\
> | Bob Bomar     bulldog@fxp.org         http://www.bomar.us/~bob |
> |================================================================|
> | FreeBSD: The Power to Serve.          http://www.freeBSD.org   |
> \----------------------------------------------------------------/

-- 
BAO RuiXian,  SOFTWARE ENGINEER,   Project Consulting,  Software
Services
AtBusiness Communications Corporation, Kaapeliaukio 1, FIN-00180
Helsinki
Telephone +358-9-2311 6674, Mobile +358-50-329 6275, Fax +358-9-2311
6601
Web: www.atbusiness.com, Email: {bao.ruixian,
ruixian.bao}@atbusiness.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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] CGI problem

Posted by Bob Bomar <bu...@fxp.org>.
On Sat, Feb 08, 2003 at 01:49:59AM +0200, BAO RuiXian wrote:
> Hello,
> 
> Bob Bomar wrote:
> > 
> > I am running Apache 1.3.27 on a FreeBSD 4.7 Server. When I go to=20
> > /cgi-bin/ from the web, I get a 500 error.  When I run the script
> > from the command line, it works fine, with the header and all.
> 
> Do you have "Content-type: text/html" as your first output line when you
> run it successfully from the command line? Otherwise, it can also cause
> the exact following error "Premature end of script headers".
> 
> Bao
> 
> Best
> 

Yes, I do.  CVSWeb works on my desktop, but not on that machine.

-- 
/----------------------------------------------------------------\
| Bob Bomar 	bulldog@fxp.org 	http://www.bomar.us/~bob |
|================================================================|
| FreeBSD: The Power to Serve.		http://www.freeBSD.org   |
\----------------------------------------------------------------/

Re: [users@httpd] CGI problem

Posted by BAO RuiXian <ba...@atbusiness.com>.
Hello,

Bob Bomar wrote:
> 
> I am running Apache 1.3.27 on a FreeBSD 4.7 Server. When I go to=20
> /cgi-bin/ from the web, I get a 500 error.  When I run the script
> from the command line, it works fine, with the header and all.

Do you have "Content-type: text/html" as your first output line when you
run it successfully from the command line? Otherwise, it can also cause
the exact following error "Premature end of script headers".

Bao

Best

> I checked my logs and I see this:
> 
> [Thu Feb  6 21:02:07 2003] [error] [client 192.168.1.13] Premature end of s=
> cript headers: /dir/to/script/cvsweb.cgi
> [Thu Feb  6 21:02:43 2003] [error] [client 192.168.1.13] Premature end of s=
> cript headers: /dir/to/script/cvsweb.cgi
> [Thu Feb  6 21:02:45 2003] [error] [client 192.168.1.13] Premature end of s=
> cript headers: /dir/to/script/cvsweb.cgi
> 
> here is the relevent portion of the httpd.conf:
> 
> <VirtualHost *>
> ServerAdmin bob@bomar.us
> DocumentRoot /usr/local/www/bob
> ServerName bob.bomar.us
> ErrorLog /var/log/bob-error
> CustomLog /var/log/bob-custom common
> ScriptAlias /cgi-bin/ "/usr/local/www/bob/cgi-bin/"
> #AddHandler cgi-script .cgi
> #AddHandler cgi-script .pl
> </VirtualHost>
> 
> --
> /----------------------------------------------------------------\
> | Bob Bomar     bulldog@fxp.org         http://www.bomar.us/~bob |
> |================================================================|
> | FreeBSD: The Power to Serve.          http://www.freeBSD.org   |
> \----------------------------------------------------------------/

-- 
BAO RuiXian,  SOFTWARE ENGINEER,   Project Consulting,  Software
Services
AtBusiness Communications Corporation, Kaapeliaukio 1, FIN-00180
Helsinki
Telephone +358-9-2311 6674, Mobile +358-50-329 6275, Fax +358-9-2311
6601
Web: www.atbusiness.com, Email: {bao.ruixian,
ruixian.bao}@atbusiness.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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] CGI problem

Posted by Bob Bomar <bu...@fxp.org>.
On Fri, Feb 07, 2003 at 02:22:41PM -0800, J. Greenlees wrote:
> > Do you have
> >
> > <Directory /usr/local/www/bob/cgi-bin/>
> > 	[...]
> > 	Options ExecCGI
> > 	[...]
> > </Directory>
> >
> > ?
> > --
> good point.
> 

<Directory "/usr/local/www/bob/cgi-bin">
AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /usr/local/etc/apache/passwd
Require user bob
        AllowOverride None
        Options None   
        Order allow,deny
        Allow from all
Options ExecCGI
</Directory>


If the script executes fromt he command line with out
any errors, useing perl cvsweb.cgi, and all my other 
perl scripts wont execute either, what could be the problem?.
-- 
/----------------------------------------------------------------\
| Bob Bomar 	bulldog@fxp.org 	http://www.bomar.us/~bob |
|================================================================|
| FreeBSD: The Power to Serve.		http://www.freeBSD.org   |
\----------------------------------------------------------------/

Re: [users@httpd] CGI problem

Posted by "J. Greenlees" <ja...@x-mail.net>.
Quoting Gary Turner <kk...@sbcglobal.net>:

> Bob Bomar wrote:
>
> >I am running Apache 1.3.27 on a FreeBSD 4.7 Server. When I go to 
> >/cgi-bin/ from the web, I get a 500 error.  When I run the script
> >from the command line, it works fine, with the header and all.
> >I checked my logs and I see this:
> >
> >[Thu Feb  6 21:02:07 2003] [error] [client 192.168.1.13] Premature end of
> s> >cript headers: /dir/to/script/cvsweb.cgi
> >[Thu Feb  6 21:02:43 2003] [error] [client 192.168.1.13] Premature end of
> s> >cript headers: /dir/to/script/cvsweb.cgi
> >[Thu Feb  6 21:02:45 2003] [error] [client 192.168.1.13] Premature end of
> s> >cript headers: /dir/to/script/cvsweb.cgi
>
> I'm no Apache guru, but I play one on TV.  In my limited experience,
> this error has always meant some kind of bug in the script.  Even a
> script that runs from the CLI can cause Apache to choke due to a logic
> error.
well it is a script error right enough, the path to the script for cvs web interface is
throwing the error, may want to look at that.

>
> >
> >here is the relevent portion of the httpd.conf:
> >
> ><VirtualHost *>
> >ServerAdmin bob@bomar.us
> >DocumentRoot /usr/local/www/bob
> >ServerName bob.bomar.us
> >ErrorLog /var/log/bob-error
> >CustomLog /var/log/bob-custom common
> >ScriptAlias /cgi-bin/ "/usr/local/www/bob/cgi-bin/"
>
> It has been pounded into my head that putting executables in a
> browseable directory tree is a Bad Thing (tm).
>
> >#AddHandler cgi-script .cgi
> >#AddHandler cgi-script .pl
> ></VirtualHost>
>
> Do you have
>
> <Directory /usr/local/www/bob/cgi-bin/>
> 	[...]
> 	Options ExecCGI
> 	[...]
> </Directory>
>
> ?
> --
good point.

-------------------------------------------------------------------------------------------
***Protect your PC from local E-Mail Application security holes***
***Maintain your Privacy - Passport Free***
***Anti SPAM "Whitelist" feature***

http://www.x-mail.net Web Based E-Mail, accessible anywhere

Voice Messages, Voice Calls, Live Chat, X-Mail Messenger,
Personal Web Hosting, 128 bit SSL Secure, Calendar, Bookmarks,
Forwarding, Virtual Mail Map Aliasing

X-Mail Premium: 20MB Messages, 100MB Storage, POP3, Ad Free

  



---------------------------------------------------------------------
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] CGI problem

Posted by Gary Turner <kk...@sbcglobal.net>.
Bob Bomar wrote:

>I am running Apache 1.3.27 on a FreeBSD 4.7 Server. When I go to=20
>/cgi-bin/ from the web, I get a 500 error.  When I run the script
>from the command line, it works fine, with the header and all.
>I checked my logs and I see this:
>
>[Thu Feb  6 21:02:07 2003] [error] [client 192.168.1.13] Premature end of s=
>cript headers: /dir/to/script/cvsweb.cgi
>[Thu Feb  6 21:02:43 2003] [error] [client 192.168.1.13] Premature end of s=
>cript headers: /dir/to/script/cvsweb.cgi
>[Thu Feb  6 21:02:45 2003] [error] [client 192.168.1.13] Premature end of s=
>cript headers: /dir/to/script/cvsweb.cgi

I'm no Apache guru, but I play one on TV.  In my limited experience,
this error has always meant some kind of bug in the script.  Even a
script that runs from the CLI can cause Apache to choke due to a logic
error.

>
>here is the relevent portion of the httpd.conf:
>
><VirtualHost *>
>ServerAdmin bob@bomar.us
>DocumentRoot /usr/local/www/bob
>ServerName bob.bomar.us
>ErrorLog /var/log/bob-error
>CustomLog /var/log/bob-custom common
>ScriptAlias /cgi-bin/ "/usr/local/www/bob/cgi-bin/"

It has been pounded into my head that putting executables in a
browseable directory tree is a Bad Thing (tm).

>#AddHandler cgi-script .cgi
>#AddHandler cgi-script .pl
></VirtualHost>

Do you have

<Directory /usr/local/www/bob/cgi-bin/>
	[...]
	Options ExecCGI
	[...]
</Directory>

?  
--
gt          kk5st@sbcglobal.net
Everything here could be wrong--Messiah's Handbook
as quoted by Bach in "Illusions"

---------------------------------------------------------------------
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] CGI problem

Posted by Nelson Goforth <ng...@earthnet.net>.
My first thought is to make sure that your 'shebang' line is correct.

If that's too cryptic, it's the first line of your script, which should 
be like "#!/usr/bin/perl" which tells the program where perl is.  A 
program without the line (or with it incorrect) will run from the 
command line but not in a browser.

Nelson

On Friday, February 7, 2003, at 02:17  PM, Bob Bomar wrote:

> I am running Apache 1.3.27 on a FreeBSD 4.7 Server. When I go to=20
> /cgi-bin/ from the web, I get a 500 error.  When I run the script
> from the command line, it works fine, with the header and all.
> I checked my logs and I see this:
>
> [Thu Feb  6 21:02:07 2003] [error] [client 192.168.1.13] Premature end 
> of s=
> cript headers: /dir/to/script/cvsweb.cgi
> [Thu Feb  6 21:02:43 2003] [error] [client 192.168.1.13] Premature end 
> of s=
> cript headers: /dir/to/script/cvsweb.cgi
> [Thu Feb  6 21:02:45 2003] [error] [client 192.168.1.13] Premature end 
> of s=
> cript headers: /dir/to/script/cvsweb.cgi
>
> here is the relevent portion of the httpd.conf:
>
> <VirtualHost *>
> ServerAdmin bob@bomar.us
> DocumentRoot /usr/local/www/bob
> ServerName bob.bomar.us
> ErrorLog /var/log/bob-error
> CustomLog /var/log/bob-custom common
> ScriptAlias /cgi-bin/ "/usr/local/www/bob/cgi-bin/"
> #AddHandler cgi-script .cgi
> #AddHandler cgi-script .pl
> </VirtualHost>
>
> -- 
> /----------------------------------------------------------------\
> | Bob Bomar 	bulldog@fxp.org 	http://www.bomar.us/~bob |
> |================================================================|
> | FreeBSD: The Power to Serve.		http://www.freeBSD.org   |
> \----------------------------------------------------------------/
> <mime-attachment>


---------------------------------------------------------------------
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