Web Hosting Talk







View Full Version : apache 2.0 cgi error


clocker1996
05-09-2002, 05:42 PM
for my domain.com

i goto www.domain.com/cgi-bin/hello.cgi

and i get:
[Thu May 09 17:31:47 2002] [error] [client 24.141.132.129] Premature end of script headers: hello.cgi

that's what error_log says for hello.cgi

all test.cgi is is this:

#!/usr/bin/perl

print "Content-Type: text/html\n\n";
print "<B>who you are</b>\n";
print "<pre>";
system('id');
print "</pre>";

this is apache 2.0

see:
# /usr/local/apache2/bin/httpd -l
Compiled in modules:
core.c
mod_access.c
mod_auth.c
mod_include.c
mod_log_config.c
mod_env.c
mod_setenvif.c
mod_ssl.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_info.c
mod_suexec.c
mod_cgi.c
mod_vhost_alias.c
mod_negotiation.c
mod_dir.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_so.c


in httpd.conf i have

# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl

and for this
ScriptAlias /cgi-bin/ /mspace/sites/domain.com/htdocs/cgi-bin/

in httpd.conf
ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

and in httpd.conf

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

anyone konw what is wrong?

clocker1996
05-09-2002, 05:48 PM
soon as i turn off apache2.0
and turn on 1.3.24

that test.cgi works.

xerocity.com
05-09-2002, 05:49 PM
The only thing that I am able to think of is maybe your path to perl.

login to your box via ssh or telnet and type "which perl" and it will tell you the location.

clocker1996
05-09-2002, 05:50 PM
[root@boxen cc]# which perl
/usr/local/bin/perl
[root@boxen cc]# ll /usr/local/bin/perl
lrwxrwxrwx 1 root root 13 May 1 00:37 /usr/local/bin/perl -> /usr/bin/perl
[root@boxen cc]# ll /usr/bin/perl
-rwxr-xr-x 2 root root 701k Mar 23 2001 /usr/bin/perl
[root@boxen cc]#

xerocity.com
05-09-2002, 05:51 PM
per your last post... scratch my last post.

Is it nessicary to upgrade to Apace 2.0? Although it considered to be stable and able to be run in a live environment, do you want to add the additional security risks of using Apache 2.0?

Because it is new many security holes still have yet to be found.

clocker1996
05-09-2002, 05:53 PM
it came out of beta already

and i am trying to mess aroudn with it

gotta do it sometime
can't stick with 1.3.24 forever

xerocity.com
05-09-2002, 05:53 PM
have you tried running the script with the first line of /usr/local/bin/perl ?

clocker1996
05-09-2002, 06:26 PM
ya

just tried it
it's still doing the same thing even wtih

#!/usr/local/bin/perl

clocker1996
05-09-2002, 06:43 PM
oh wait
suexec log shows
[2002-05-09 18:17:08]: uid: (507/master) gid: (507/507) cmd: hello.cgi
[2002-05-09 18:17:08]: command not in docroot (/mspace/sites/drirc.net/htdocs/cgi-bin/hello.cgi)
i c
i think i know why now
because the suexec docroot is /home
but
the actual site is /mspace/sites/domain.com/htdocs

what should i change the docroot to, do you know what would be good? all sites will be /mspace/sites/domain.com/htdocs

clocker1996
05-09-2002, 07:27 PM
got it

thanks

docroot=/mspace/sites