Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rewrite map program - no environment variables?

Status
Not open for further replies.

ralftorsten

IS-IT--Management
Dec 6, 2006
6
LU
Hi,
I have been looking for a solution to my problem almost everywhere now, but still no success. Maybe someone here can help!

I have a program that acts as a rewrite map to mod_rewrite. Now, Apache starts the map only once, and not for every request. So far so good. I'd like to read a variable from the operating system (Solaris) environment, from which I start Apache (which I assumed to be the same passed on to the rewrite map program).

PassEnv and SetEnv directives seem indeed only to work for SSIs and CGIs as indicated in the documentation. In fact, the environment from which the rewrite map is started appears to be completely empty.

How can I pass an environment variable value to the rewrite map program? Or, what would be an elegant alternative to pass some configuration info (e.g. documentroot path) to the rewrite map program?

Kind regards

Ralf


 
Hi,thanks for the quick answer! :)
I understand how I can use this to condition the execution of the rewrite rules, but how would I access this variable INSIDE a program used as the rewrite map, say executed if the condition you mention is matched?

Ralf
 
Well within perl you should be able to access the variable like so. Is this what you are talking about?
Code:
#!/usr/bin/perl

print "content-type:text/html\n\n";
print $ENV{DOCUMENT_ROOT);

M. Brooks
 
Yes, exaclty, but the environment from which Apache calls the rewrite map program appears to be totally empty. In Perl, the %ENV hash is empty, I have just tried (my program is in C++). I expected, that Apache would call the program with the same environment that Apache itself is started, but this does not seem to be the case. :-(
 
Noone else who is using rewrite map programs and has to pass parameters to this program?
 
So, it seems I am really the only one here with this problem... ok,I'll have to search further...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top