Hi Lee,
Thanks for your reply. I tried the script you sent and it failed
with "document contains no data". This is odd because I
previously found that mod_perl API scripts ran ok but CGI scripts
running under mod_perl failed.
The script printed some output in the log which I have attached
below. I've also attached the earlier messages in the thread in
case they might help.
Any further comments much appreciated.
George Savvides.
Script output
=============
I've edited the output, removing most of the HTML which is quite
long, please let me know if I've left out something important.
Connection: close
Date: Mon, 03 Feb 2003 09:36:13 GMT
Server: Apache
Content-Type: text/html
Client-Date: Mon, 03 Feb 2003 09:36:13 GMT
Client-Peer: 194.203.134.150:80
Link: </xxx/styles/menu.css>; rel="stylesheet"; type="text/css"
Title: xxx - anti-virus for business
X-Meta-Description: xxx Anti-Virus, leading anti-virus developer,
provide information and software designed to counter computer
viruses, trojan horses, and virus hoaxes. Software available for
download.
X-Meta-Generator: HTML Tidy for FreeBSD (vers 1st February 2002),
see www.w3.org
X-Meta-Keywords: xxx, anti-virus, anti virus, antivirus, data
security, software, SWEEP, InterCheck, Windows, Windows 3.1x,
DOS, Windows 95/98, Windows NT, OS/2, NetWare, OpenVMS, Unix,
Macintosh, Windows 2000, free, protection, downloads gateway
virus protection
X-Meta-MSSmartTagsPreventParsing: TRUE
Apache::ROOTse_2diceland_2exxx_2ecom::perlbin::testwarn_2epl::handler('Apache=SCALAR(0xb094330)')
called at
/usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm
line 143
eval {...} called at
/usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm
line 143
Apache::Registry::handler('Apache=SCALAR(0xb094330)') called
at /dev/null line 0
eval {...} called at /dev/null line 0
<html lang="en">
<head>
<meta name="generator" content="HTML Tidy for FreeBSD (vers 1st
February 2002), see www.w3.org">
etc ... html
</tr>
</table>
<br>
<!-- xxx Footer: end -->
</body>
</html>
Apache::ROOTse_2diceland_2exxx_2ecom::perlbin::testwarn_2epl::handler('Apache=SCALAR(0xb094330)')
called at
/usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm
line 143
eval {...} called at
/usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm
line 143
Apache::Registry::handler('Apache=SCALAR(0xb094330)') called
at /dev/null line 0
eval {...} called at /dev/null line 0
Previous messages in thread
===========================
My original message
-------------------
Hi all,
I am having problems running cgi scripts under mod_perl. I
realise that this question has been asked before but I have not
been able to find a reference to this particular behaviour in the
manuals or newsgroups.
Problem summary
---------------
Scripts running under mod_perl fail. Netscape returns the popup
'The document contained no data'
Nothing is printed in the browser window. Scripts that use the
mod_perl api work OK.
Example scripts
---------------
The cgi script below fails.
#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print "Hello World\n";
The mod_perl api script below works.
my $r = Apache->request;
$r->content_type("text/plain");
$r->send_http_header;
$r->print("Hello World");
Script configuration
--------------------
Alias /perlbin ${TOP}/perlbin
PerlModule Apache::Registry
<Location /perlbin>
SetHandler perl-script
Perlhandler Apache::Registry
Options +ExecCGI
allow from all
PerlSendHeader On
</Location>
Machine config
--------------
The cgi script fails on this box:
FreeBSD 4.5-RELEASE-p23
Apache/1.3.27
perl-5.8.0
mod_perl-1.26
The same cgi script with the same script config works fine on
this one:
FreeBSD 4.5-RELEASE-p23
Apache/1.3.20
perl-5.005_03
mod_perl-1.26
It looks as if the CGI script is not returning its stdout to the
browser but I can't for the life of me see why. Any help would
be very much appreciated.
George Savvides
Reply from Stas Bekman
----------------------
What has error_log to say about this? Do you have the file perms
right?
Lee Goddard wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: MD5
>
> Hi George,
>
> I've not seen any of this thread other than what's
> below, but have you had all the headers output correctly?
>
> Try running this after setting $url, and see what you get:
>
> use LWP::UserAgent;
> $url = "http://195.117.126.24";
> $ua = LWP::UserAgent->new;
> $req = new HTTP::Request('GET', $url); # Format URL request
> $res = $ua->request($req);
> if (not $res->is_success()) {
> die "...failed:\n" . $res->error_as_HTML
> }
> warn $res->headers_as_string;
> warn $res->content;
> #open OUT, ">/test.html";
> #print OUT $res->content;
> #close OUT;
> exit;
>
> Lee
>
> On Sunday, February 2, 2003 at 7:42:12 PM, you wrote:
>
> GS> Hi Stas,
>
> GS> Thanks for your reply.
>
> GS> The file perms are correct and nothing is printed to the logs.
> GS> The scripts do run. If you write a script with a redirect in it
> GS> for instance, the redirect is made. They just don't seem to
> GS> print anything to stdout.
>
> GS> Regards, George Savvides.
>
> GS> Stas Bekman wrote:
>
> >>
> >> What has error_log to say about this? Do you have the file perms right?
> >>
>
> - --
> Cheers
> Lee mailto:[EMAIL PROTECTED]
>
> $$=qw$808273788400074285838400657879847269820080698276007265677569820727$;
> $$=~s$(\d\d)$\$_.=chr(\$1+32)$ge;eval;
>
> -----BEGIN PGP SIGNATURE-----
> Version: 2.6
>
> iQCVAwUAPj1zYqdrfekeF/QBAQEDxgQAoYOSvKGOBHUXgwRcRHdatlAo71tpR4NQ
> 55fgPbL0e20JiKQ+0X8xbbT6Lixh1ytkIfJZIr3J+7iiIYagkGkrMukFw9IrfMgF
> pxu5zY589u1U8BrSzlQIUtMuvmtc40JXZMh5jc/zuasVw0WaeHRVAVsi6wa7qCDE
> 4MDgvzcuz/g=
> =k9JH
> -----END PGP SIGNATURE-----
--
7, College View, Cirencester, Gloucestershire, GL7 1WD, UK
07957 141204
[EMAIL PROTECTED]