logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: CGI Environment DOCUMENT_* variables - any advice?
Author
toddm



Joined: 20 May 2011
Posts: 3

PostPosted: Wed 25 May '11 14:50    Post subject: CGI Environment DOCUMENT_* variables - any advice? Reply with quote

Hello Everyone,

I am hoping to set Apache up so that it will include the DOCUMENT_* variables in the CGI environment, particularly DOCUMENT_URI and DOCUMENT_NAME. I understand that these variables are generally SSI, so I have attempted to enable Includes in the following ways:

- mod_include is uncommented in my httpd.conf file
- in <IfModule mime_module> I have the following:
AddType text/html .pl
AddOutputFilter
- <Directory /> contains Options Includes
- <Directory "x:/webroot"> contains Options Includes

I am new to Apache; I am in the midst of migrating from Sambar. Any advice, direction or recipes for quiche would be most appreciated.

Thanks for your time! I would be happy to provide more info as desired.

Todd
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Fri 27 May '11 9:49    Post subject: Reply with quote

Do you want what variables in your script? What are you using? perl? PHP? Other cgi?
Back to top
toddm



Joined: 20 May 2011
Posts: 3

PostPosted: Fri 27 May '11 17:44    Post subject: Reply with quote

Hey James,

Thanks for your reply. I guess in retrospect, my post did leave out some crucial details.

I am hoping to access environment variables from Perl, through the Environment hash (%ENV). Sambar automatically populated %ENV with DOCUMENT_NAME and DOCUMENT_URI; those are the primary variables I am hoping to capture in Apache.

I understand that Apache provides SCRIPT_NAME by default in %ENV which can be manipulated to return the same information that DOCUMENT_NAME and DOCUMENT_URI would essentially provide, however, I am in a situation where significant legacy code is being migrated that relies on the presence of the DOCUMENT_* variables.

In the interim, I've created a Perl library that will synthesize the DOCUMENT_* variables in the Apache environment; while this works, I'd prefer not to have to shoehorn a solution and instead, configure Apache as required.

Thanks again for your time and any advice you may be able to offer.

Todd
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sat 28 May '11 3:51    Post subject: Reply with quote

They are there

$ENV{'DOCUMENT_ROOT'} = C:/Apache22/htdocs
$ENV{'REQUEST_URI'} = /env.pl
Back to top
toddm



Joined: 20 May 2011
Posts: 3

PostPosted: Mon 30 May '11 16:09    Post subject: Reply with quote

Thanks for your reply.

Yes, I did see those particular keys in the environment hash, and they do work for my needs. However, I was in a situation in which there were several (possibly 100) scripts that relied on the presence of the DOCUMENT_NAME and DOCUMENT_URI variables.

All is well now; I've implemented a library that the older scripts refer to which populates the aforementioned DOCUMENT_* variables if they do not exist in the environment hash. I was just hoping there was a way to configure Apache to populate those variables automatically.

Thanks again for your help and have a great day!

Todd
Back to top


Reply to topic   Topic: CGI Environment DOCUMENT_* variables - any advice? View previous topic :: View next topic
Post new topic   Forum Index -> Apache