Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Urgent Help required with PERL CGI

by blue_cowdawg (Monsignor)
on Dec 24, 2012 at 15:46 UTC ( #1010204=note: print w/replies, xml ) Need Help??

in reply to Urgent Help required with PERL CGI

      The values of variables present in my environment doesn't appear.. How to get the value of my local (not cgi variables) variables displayed through browser.

This comes as no surprise to me and as Corion and others have pointed out CGI usually runs as its own userid. For instance on Apache based web environments the userid can be one of but not limited to:

  • apache
  • httpd
  • web
  • www
  • www-data
  • www-user
  • nobody
  • noaccess
  • nofiles
with the last three given in descending order of likelihood in my experience. My own hosting environment that I rent out uses the same account as the person renting space. Makes my life much easier.

My advise to you is to never count on your personal account's environment to be available to you in a CGI script. When writing CGI I either hardcode what I need (not the ideal) or I set up a configuration file (better) with what I need. If you use FindBin to find where the script is running from and if your configuration file is in a directory related to where the script is being run you can easily open that configuration file and populate what you need to run the CGI.

Hope this helps...

Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010204]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2017-12-13 00:06 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (341 votes). Check out past polls.