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: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Using sybperl with cgi
Date: Feb 16 1999 4:22PM

>>>>> "Sheree" == Sheree Hemphill  writes:

Sheree> I wrote the following program, which accesses the data
Sheree> correctly when run from the command prompt:



What is your $SYBASE environment variable set to when you run your
script from the shell?

For a CGI script you need to set this environment variable too. This
can either be done in the script, or via the httpd server's config
files.

To set the env. variable in the script you need to do this:

#!/usr/local/bin/perl -w

BEGIN {
   $ENV{SYBASE} = "/where/I/have/sybase";
}

use strict;
use Sybase::CTlib;
use CGI qw(:standard);

my $dbh = new Sybase::CTlib ...

etc...

I don't know the commands to set the env. variables in all the various 
httpd servers, but for Apache you can add this to the httpd.conf file:

SetEnv SYBASE /where/I/have/sybase

and restart the server. Now all scripts will have the $SYBASE
env. variable set correctly.

Of course you should replace /where/I/have/sybase with the real path
to your Sybase installation :-)

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@mbay.net       -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com