Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Robb Canfield <robbc at canfield dot com>
Subject: Re: sybperl on RH5.1
Date: Jun 23 1998 5:41PM

Can you run the scripts by themselves (outside of Apache).  The message
"Premature end of script headers" can occur if the script fails with a Core
Dump (common in Sybperl & Red Hat). See if a 'core' file is present with a
time/date that would indicate it was associated with the script. If you are
getting core dumps then check the following:

	Did all of the tests pass when you compiled Sybperl?
		If not start there and track down the problem. See:
		I have found the advice on checking that '-ltcl' -> '-lsybtcl'
		to be critical for Sybperl, DBD and DBI

	Does the script have the proper environment when running under Apache?
		Check this by having the script write to a text file the contents of the
		before doing anything else:
			open(T, ">t")  || die "Unable to open log file"
			foreach(keys %ENV) { print T "$_ = $ENV{$_}\n"; }
			close T;
		This is the MOST common problem I have seen.

	Does Apache have proper access to the 'interfaces' file in Sybase directory?
		See if you can read the file directory with a simple Perl script.

Hope this helps

At 02:00 PM 6/23/98 +0800, you wrote:
>I've installed  SybPerl 2.09.05 on a RedHat 5.1 Linux box, with dynamic
>Sybase CTlib, then I moved some simple CGIs  from my old Slackware 3.4
>WWW server to this new one.
>But now I can't run them!
>If I run this small scripts (mostly is very simple query , such as
>'SELECT * FROM.." in command line, it works fine.
>If I get rid off the "use Sybase::CTlib;" , it works, but can't access
>the backend MS SQL Server 6.5 .
>Apache's error message is
>[Tue Jun 23 02:12:08 1998] access to /home/httpd/cgi-bin/ failed
>for, reason: Premature end of script headers
>My scripts is
>use Sybase::CTlib;
>my $dbh = new Sybase::CTlib('sa', '', 'PROSERVER');
>$dbh->ct_sql("use HangTian");
>my $sql = 'SELECT * FROM QuesAnsw
>          WHERE id < 1005 ';
>my @rows = $dbh->ct_sql($sql);
>my $thisrow;
>foreach $thisrow (@rows) {
>        print ${$thisrow}[1]." ---- ".${$thisrow}[2]."\n" ;
>Oh help me.
>Yao Fei.