Keith Hansen
|
| Posted: 01/28/2003, 11:23 AM |
|
Guys,
I'm Configuring CCS to generate Perl CGI.
When browsing the created CGI, the following error is written to the Apache
error log:
[Tue Jan 28 14:07:24 2003] [error] [client 11.111.111.11] Premature end
of script headers: /accountpath/www/index.cgi
The following are the first few lines of the 'index.cgi' script:
#!/usr/local/bin/perl
package clsGridy2k; #y2k class @2-D22F5FFF
#Inheritance @2-E962A632
use FindBin;
use lib ".";
use Common;
use Sorter;
use Navigator;
@ISA = qw/clsy2kDataSource Sorter Navigator/;
#End Inheritance
#Class clsGridy2k constructor @2-C10B0ADD
.
.
.
Does anyone have some thoughts on what may be the cause?
Many thanks.
Keith.
|
|
|
 |
DAVID
|
| Posted: 01/28/2003, 12:03 PM |
|
There is another line in error logs that preceids the one you show here.
Please post it.
"Keith Hansen" <keith.hansen@usa.net> wrote in message
news:b16lc4$su1$1@news.codecharge.com...
> Guys,
>
> I'm Configuring CCS to generate Perl CGI.
> When browsing the created CGI, the following error is written to the
Apache
> error log:
>
> [Tue Jan 28 14:07:24 2003] [error] [client 11.111.111.11] Premature
end
> of script headers: /accountpath/www/index.cgi
>
> The following are the first few lines of the 'index.cgi' script:
>
> #!/usr/local/bin/perl
>
> package clsGridy2k; #y2k class @2-D22F5FFF
>
> #Inheritance @2-E962A632
> use FindBin;
> use lib ".";
> use Common;
> use Sorter;
> use Navigator;
> @ISA = qw/clsy2kDataSource Sorter Navigator/;
> #End Inheritance
>
> #Class clsGridy2k constructor @2-C10B0ADD
> .
> .
> .
>
> Does anyone have some thoughts on what may be the cause?
>
> Many thanks.
>
> Keith.
>
>
|
|
|
 |
DAVID
|
| Posted: 01/28/2003, 12:08 PM |
|
You could also debug it if you add a line
print "Content-type: text/html\n\n"; beneath #!/usr/local/bin/perl
also, check that execution bits are set on your cgi ( chmod 0755 *.cgi)
and that you can actually execute the cgi manually (./index.cgi )
your perl interpreter might be in /usr/bin/perl (if this is a generic linux
build), so this should be a checkpoint as well.
"Keith Hansen" <keith.hansen@usa.net> wrote in message
news:b16lc4$su1$1@news.codecharge.com...
> Guys,
>
> I'm Configuring CCS to generate Perl CGI.
> When browsing the created CGI, the following error is written to the
Apache
> error log:
>
> [Tue Jan 28 14:07:24 2003] [error] [client 11.111.111.11] Premature
end
> of script headers: /accountpath/www/index.cgi
>
> The following are the first few lines of the 'index.cgi' script:
>
> #!/usr/local/bin/perl
>
> package clsGridy2k; #y2k class @2-D22F5FFF
>
> #Inheritance @2-E962A632
> use FindBin;
> use lib ".";
> use Common;
> use Sorter;
> use Navigator;
> @ISA = qw/clsy2kDataSource Sorter Navigator/;
> #End Inheritance
>
> #Class clsGridy2k constructor @2-C10B0ADD
> .
> .
> .
>
> Does anyone have some thoughts on what may be the cause?
>
> Many thanks.
>
> Keith.
>
>
|
|
|
 |
Keith
|
| Posted: 01/29/2003, 10:18 AM |
|
Thanks David,
I've added the printing of the Content type.
I also switched our testing to v2 of CC; whereas, yesterday we were using v1
of CCS.
The result from IE is identical as yesterday.
Execution of 'index.cgi' from the command line yields the following:
Content-type: text/html
Set-Cookie: SessionID=[a really big number]; path=/; expires=Wed,
29-Jan-2003 18:20:53 GMT
Content-type: text/html
Can't call method "prepare" on unblessed reference at Common.pm line 92.
The 'error' log entries created are thus:
[Wed Jan 29 12:53:30 2003] [error] [client 1.1.1.1] File does not exist:
/homepath/www/Themes/RockIt/Background.gif
[Wed Jan 29 12:53:30 2003] [error] [client 1.1.1.1] File does not exist:
/homepath/www/404.html
[Wed Jan 29 12:53:33 2003] [error] [client 1.1.1.1] Premature end of
script headers: /homepath/www/index.cgi
Keith.
"DAVID" <codecharge_newsfeed@stridetech.com> wrote in message
news:b16nvs$2fb$1@news.codecharge.com...
> You could also debug it if you add a line
> print "Content-type: text/html\n\n"; beneath #!/usr/local/bin/perl
>
> also, check that execution bits are set on your cgi ( chmod 0755 *.cgi)
> and that you can actually execute the cgi manually (./index.cgi )
>
> your perl interpreter might be in /usr/bin/perl (if this is a generic
linux
> build), so this should be a checkpoint as well.
>
> "Keith Hansen" <keith.hansen@usa.net> wrote in message
>news:b16lc4$su1$1@news.codecharge.com...
> > Guys,
> >
> > I'm Configuring CCS to generate Perl CGI.
> > When browsing the created CGI, the following error is written to the
> Apache
> > error log:
> >
> > [Tue Jan 28 14:07:24 2003] [error] [client 11.111.111.11] Premature
> end
> > of script headers: /accountpath/www/index.cgi
> >
> > The following are the first few lines of the 'index.cgi' script:
> >
> > #!/usr/local/bin/perl
> >
> > package clsGridy2k; #y2k class @2-D22F5FFF
> >
> > #Inheritance @2-E962A632
> > use FindBin;
> > use lib ".";
> > use Common;
> > use Sorter;
> > use Navigator;
> > @ISA = qw/clsy2kDataSource Sorter Navigator/;
> > #End Inheritance
> >
> > #Class clsGridy2k constructor @2-C10B0ADD
> > .
> > .
> > .
> >
> > Does anyone have some thoughts on what may be the cause?
> >
> > Many thanks.
> >
> > Keith.
> >
> >
>
>
|
|
|
 |
DAVID
|
| Posted: 01/29/2003, 12:12 PM |
|
prepare is a method of database handle object .
Looks like your app failed to connect to the database server. Normally the
logic of any db operation would follow the following:
1. Connect to the database
my $dbh=DBI->connect($dsn,$username,$password,...);
DBI->connect could return undefined value that whould signify a failure.
So this is better written as
my $dbh=DBI->connect($dsn,$username,$password,...)
or print(sprintf ("Content-type: text/html\n\n%s:%s\n","DATABASE
CONNECT ERROR",$DBI::errstr)),die($DBI::errstr);
2. Prepare statement
my $sth=$dbh->prepare($sql);
3. Execute (possible execute loop)
$sth->execute();
If you fail to abort and report an error in 1.) then in 2.) you will
encounter that same you post here. This is because you are trying to access
a method 'prepare' on an undefined value. Codecharge keeps all handles in
hash references, not plain scalars, hence "Can't call method "prepare" on
unblessed reference".
Below is the code produced by codecharge:
...............
$self->{dbh} = DBI->connect( $self->{DataSource}, $self->{UserName},
$self->{Password}, { PrintError => $self->{PrintError}, Rai
seError => $self->{RaiseError} } )
or die $DBI::errstr;
......................
sub query {
my ($self, $sql) = @_;
return 0 if (!$sql);
$self->{sth} = undef;
$self->{sth} = $self->{dbh}->prepare( $sql );
if ($DBI::errstr) {
$self->{Errors}->addError($DBI::errstr);
return 0
}
$self->{sth}->execute();
if ($DBI::errstr) {
$self->{Errors}->addError($DBI::errstr);
return 0
}
}
A few things to check:
1. check if username or password contain characters that would be
interpolated in double quotes (i.e. @ $)
2. try logging in from your server to the database with a binary client (may
be a routing / firewall problem preventing your connect).
3. try to uncheck "Connection is cached" in the server tab of the connection
properties(I had and still have this problem in my installation).
4. If your connect fails, then you should see a reason for failure in the
logs. Since it is not there, I assume that you might have had some custom
event or code that inadvertantly overwritten live database handler with some
garbage. If you know how to use perl debugger, you could trace it with
something like this:
#> perl -d index.cgi
> b clsDB{your_database_connection_name}::query
> c
> n
> p ($self->{dbh}->{Active})?"CONNECTION IS GOOD":"CONNECTION IS BROKEN";
>
Example:
devdb:/apps/apache/htdocs/flane>perl -d index.cgi
Default die handler restored.
Loading DB routines from perl5db.pl version 1.07
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
clsGridxchange: index.cgi:159): @ISA = qw/clsxchangeDataSource
Sorter Navigator/;
DB<1> b clsDBinternet::query
DB<2> c
clsDBinternet::query(Common.pm:1642):
1642: my ($self, $sql) = @_;
DB<2> n
clsDBinternet::query(Common.pm:1643):
1643: return 0 if (!$sql);
DB<2> p $self->{dbh}->{Active}
1
DB<3> p ($self->{dbh}->{Active})?"CONNECTION IS GOOD":"CONNECTION IS
BROKEN";
CONNECTION IS GOOD
Good luck.
"Keith" <codecharge_newsfeed@stridetech.com> wrote in message
news:b195t2$o4i$1@news.codecharge.com...
> Thanks David,
>
> I've added the printing of the Content type.
> I also switched our testing to v2 of CC; whereas, yesterday we were using
v1
> of CCS.
> The result from IE is identical as yesterday.
>
> Execution of 'index.cgi' from the command line yields the following:
>
> Content-type: text/html
> Set-Cookie: SessionID=[a really big number]; path=/; expires=Wed,
> 29-Jan-2003 18:20:53 GMT
> Content-type: text/html
>
> Can't call method "prepare" on unblessed reference at Common.pm line 92.
>
> The 'error' log entries created are thus:
> [Wed Jan 29 12:53:30 2003] [error] [client 1.1.1.1] File does not
exist:
> /homepath/www/Themes/RockIt/Background.gif
> [Wed Jan 29 12:53:30 2003] [error] [client 1.1.1.1] File does not
exist:
> /homepath/www/404.html
> [Wed Jan 29 12:53:33 2003] [error] [client 1.1.1.1] Premature end of
> script headers: /homepath/www/index.cgi
>
> Keith.
>
> "DAVID" <codecharge_newsfeed@stridetech.com> wrote in message
>news:b16nvs$2fb$1@news.codecharge.com...
> > You could also debug it if you add a line
> > print "Content-type: text/html\n\n"; beneath #!/usr/local/bin/perl
> >
> > also, check that execution bits are set on your cgi ( chmod 0755 *.cgi)
> > and that you can actually execute the cgi manually (./index.cgi )
> >
> > your perl interpreter might be in /usr/bin/perl (if this is a generic
> linux
> > build), so this should be a checkpoint as well.
> >
> > "Keith Hansen" <keith.hansen@usa.net> wrote in message
> >news:b16lc4$su1$1@news.codecharge.com...
> > > Guys,
> > >
> > > I'm Configuring CCS to generate Perl CGI.
> > > When browsing the created CGI, the following error is written to the
> > Apache
> > > error log:
> > >
> > > [Tue Jan 28 14:07:24 2003] [error] [client 11.111.111.11]
Premature
> > end
> > > of script headers: /accountpath/www/index.cgi
> > >
> > > The following are the first few lines of the 'index.cgi' script:
> > >
> > > #!/usr/local/bin/perl
> > >
> > > package clsGridy2k; #y2k class @2-D22F5FFF
> > >
> > > #Inheritance @2-E962A632
> > > use FindBin;
> > > use lib ".";
> > > use Common;
> > > use Sorter;
> > > use Navigator;
> > > @ISA = qw/clsy2kDataSource Sorter Navigator/;
> > > #End Inheritance
> > >
> > > #Class clsGridy2k constructor @2-C10B0ADD
> > > .
> > > .
> > > .
> > >
> > > Does anyone have some thoughts on what may be the cause?
> > >
> > > Many thanks.
> > >
> > > Keith.
> > >
> > >
> >
> >
>
>
|
|
|
 |
|