Home > Archive > PERL CGI Beginners > May 2004 > how to set env variables?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to set env variables?
|
|
| Reynard Hilman 2004-05-22, 11:32 am |
| Hi,
I have a perl script that runs just fine from command line but not when
I run it as cgi. I think it's because there are some env variables that
doesn't exist when I run it as cgi. Is there a way to set the variables
from the perl script?
I tried $ENV{'VAR'} = 'value';
but it doesn't make a difference.
btw, I'm using apache as the webserver. Should I set the env variables
from apache config instead?
any suggestion?
thanks,
- reynard
| |
| Charles K. Clarkson 2004-05-22, 11:32 am |
| Reynard Hilman <reynardmh@lightsky.com> wrote:
:
: I have a perl script that runs just fine from command
: line but not when I run it as cgi. I think it's because
: there are some env variables that doesn't exist when I
: run it as cgi. Is there a way to set the variables from
: the perl script?
: I tried $ENV{'VAR'} = 'value';
That usually works.
: but it doesn't make a difference.
Perhaps it's not an environment variable problem.
: btw, I'm using apache as the webserver. Should I set
: the env variables from apache config instead?
That will set the variable across the entire server
and is one recommended way. What happened when you tried
that?
: any suggestion?
Show us your code. Let us confirm your reasoning.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
| |
| Manoj Zanwar 2004-05-22, 11:32 am |
| Did you try, restarting the apache server. As some thread/processes might
still carry the old values
Manoj
>From: "Charles K. Clarkson" <cclarkson@htcomp.net>
>To: <beginners-cgi@perl.org>
>Subject: RE: how to set env variables?
>Date: Mon, 10 May 2004 19:58:27 -0500
>MIME-Version: 1.0
>Received: from onion.perl.org ([63.251.223.166]) by mc4-f25.hotmail.com
>with Microsoft SMTPSVC(5.0.2195.6824); Mon, 10 May 2004 17:58:53 -0700
>Received: (qmail 3429 invoked by uid 1005); 11 May 2004 00:58:41 -0000
>Received: (qmail 3412 invoked from network); 11 May 2004 00:58:41 -0000
>X-Message-Info: JGTYoYF78jFINkMz3V7K7hTGsoWfBmdc
>Mailing-List: contact beginners-cgi-help@perl.org; run by ezmlm
>Precedence: bulk
>List-Post: <mailto:beginners-cgi@perl.org>
>List-Help: <mailto:beginners-cgi-help@perl.org>
>List-Unsubscribe: <mailto:beginners-cgi-unsubscribe@perl.org>
>List-Subscribe: <mailto:beginners-cgi-subscribe@perl.org>
>Delivered-To: mailing list beginners-cgi@perl.org
>Delivered-To: beginners-cgi@perl.org
>X-Spam-Status: No, hits=0.0 required=7.0tests=
>X-Spam-Check-By: la.mx.develooper.com
>Message-ID: <00a201c436f3$129c4300$9cba8243@charles>
>X-MSMail-Priority: Normal
>X-Mailer: Microsoft Outlook, Build 10.0.4510
>In-Reply-To: <40A0217C.9080108@lightsky.com>
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
>X-Spam-Rating: onion.develooper.com 1.6.2 0/1000/N
>Return-Path: beginners-cgi-return-10814-zanwarm=hotmail.com@perl.org
>X-OriginalArrivalTime: 11 May 2004 00:58:55.0991 (UTC)
>FILETIME=[22ACA870:01C436F3]
>
>Reynard Hilman <reynardmh@lightsky.com> wrote:
>:
>: I have a perl script that runs just fine from command
>: line but not when I run it as cgi. I think it's because
>: there are some env variables that doesn't exist when I
>: run it as cgi. Is there a way to set the variables from
>: the perl script?
>: I tried $ENV{'VAR'} = 'value';
>
> That usually works.
>
>
>: but it doesn't make a difference.
>
> Perhaps it's not an environment variable problem.
>
>
>: btw, I'm using apache as the webserver. Should I set
>: the env variables from apache config instead?
>
> That will set the variable across the entire server
>and is one recommended way. What happened when you tried
>that?
>
>
>: any suggestion?
>
> Show us your code. Let us confirm your reasoning.
>
>
>HTH,
>
>Charles K. Clarkson
>--
>Mobile Homes Specialist
>254 968-8328
>
>
>
>--
>To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
>For additional commands, e-mail: beginners-cgi-help@perl.org
><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
________________________________________
_________________________
Getting married? Find tips, tools and the latest trends at MSN Life Events.
http://lifeevents.msn.com/category.aspx?cid=married
| |
| Reynard Hilman 2004-05-22, 11:32 am |
|
I think I figured it out now, I set it from the httpd.conf like this
SetEnv VAR "Value"
and restart the apache, now it works.
thank you all for the suggestions,
- reynard
Charles K. Clarkson wrote:
>Reynard Hilman <reynardmh@lightsky.com> wrote:
>:
>: I have a perl script that runs just fine from command
>: line but not when I run it as cgi. I think it's because
>: there are some env variables that doesn't exist when I
>: run it as cgi. Is there a way to set the variables from
>: the perl script?
>: I tried $ENV{'VAR'} = 'value';
>
> That usually works.
>
>
>: but it doesn't make a difference.
>
> Perhaps it's not an environment variable problem.
>
>
>: btw, I'm using apache as the webserver. Should I set
>: the env variables from apache config instead?
>
> That will set the variable across the entire server
>and is one recommended way. What happened when you tried
>that?
>
>
>: any suggestion?
>
> Show us your code. Let us confirm your reasoning.
>
>
>HTH,
>
>Charles K. Clarkson
>
>
|
|
|
|
|