PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Hugh Caley <hcaley at tdl dot com>
Subject: CGI Problem
Date: Feb 18 1998 6:10PM

I am attempting to access a Sybase 11 database using CGI.  The server is

the latest non-beta Apache, Perl is 5.004_04, platform is Solaris 2.5.1,

Sybperl is 2.09.

I can run the script from the command line, and it works fine.  When I
try to access it from the web, I get a #500 error, and the httpd log
reads:

The context allocation routine failed when it tried to load localization

files!!
One or more following problems may caused the failure

Your sybase home directory is /sybase. Check the environment variable
SYBASE if it is not the one you want!
Cannot access file /sybase/config/objectid.dat
Sybase::CTlib initialize: cs_ctx_alloc() failed at
/usr/local/lib/perl5/sun4-solaris/5.00404/DynaLoader.pm line 185.
BEGIN failed--compilation aborted at /var/hughc/apache/cgi-bin/ctest.pl
line 8.
[Wed Feb 18 09:45:24 1998] access to /var/hughc/apache/cgi-bin/ctest.pl
failed for 192.9.200.233, reason: Premature en
d of script headers

The sybase client folder is in /usr/sybase, and in fact the script
prints out the $SYBASE env var as "/usr/sybase", so why am I getting the

error above?  I have tried running httpd as various users, with no
obvious effect, including as "localsyb" which has the /usr/sybase path.

The text of the script is below, a modified version of Mike's ct_sql.pl
script.

#!/usr/bin/perl
#
#       @(#)ct_sql.pl   1.2     8/7/95

# Using the special one step query routine ct_sql().
# use lib '/usr/src/sybperl-2.09/Sybperl';

use Sybase::CTlib;

$d = new Sybase::CTlib sa, *******, ******;

# ct_sql() returns a 'reference' to an array:
$ref = $d->ct_sql("select * from misc_perl_test..bbpeople where
lastname=\"Robinson\" order by firstname");

print "Content-type: text/html", "\n\n";

print "", "\n";
print "Sybperl Test", "\n";
print "

Sybperl CGI Test

", "\n"; print "Path to Sybase is $ENV{SYBASE}", "\n"; print "
";

foreach $line (@$ref)  # 'de-reference' the pointer
{
    print "@$line\n";
}
print "
", "\n"; print "", "\n" -- Hugh Caley, System Administrator Babcock & Brown, Inc., San Francisco 1+512+1515x694 | hughc@babcockbrown.com