You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sébastien Moretti <se...@unil.ch> on 2010/10/20 14:49:09 UTC

[users@httpd] Re-use of a Setenv directive

Hi

I have defined a SetEnv Directive this way:
     SetEnv BASE_PATH /tmp/smthg

I would like to re-use this variable in another SetEnv Directive, e.g.:
     SetEnv PATHS $BASE_PATH/a:$BASE_PATH/b:$BASE_PATH/c:...


But $BASE_PATH is not interpreted as a variable.
I tried with quotes, back-splash, ...


How can I re-use this variable in another SetEnv Directive ?
Thanks




Apache 2.2.3, Linux kernel 2.6.18, x86_64

-- 
Sébastien Moretti
Department of Ecology and Evolution,
Biophore, University of Lausanne,
CH-1015 Lausanne, Switzerland

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Apache 2.2.3 > mod_disk_cache not caching if a DirectoryIndex is used

Posted by Geoff Millikan <gm...@t1shopper.com>.
This issue impacts all index.html, index.php, index.shtml, etc files even
the "homepage." For example: 

This is cached: http://www.mycompany.com/index.php

This *is not* cached: http://www.mycompany.com/



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Apache 2.2.3 > mod_disk_cache not caching if a DirectoryIndex is used

Posted by Geoff Millikan <gm...@t1shopper.com>.
Is this a known bug?

At URL #1 below the content isn't cached (or served out of cache):
http://www.t1shopper.com/mod_disk_cache_bug/

At URL #2, we just add the "index.php" into the URL string and the cache is
working properly (see log below).
http://www.t1shopper.com/mod_disk_cache_bug/index.php

Am I missing something?

Thanks,

http://www.t1shopper.com/


---= Log from URL #1 =---
[Mon Apr 11 00:28:13 2011] [debug] mod_cache.c(131): Adding CACHE_SAVE
filter for /mod_disk_cache_bug/
[Mon Apr 11 00:28:13 2011] [debug] mod_cache.c(138): Adding CACHE_REMOVE_URL
filter for /mod_disk_cache_bug/
[Mon Apr 11 00:28:13 2011] [debug] mod_deflate.c(602): [client 71.177.216.6]
Zlib: Compressed 19 to 21 : URL /mod_disk_cache_bug/index.php


---= Log from URL #2 (First Request) =---
[Mon Apr 11 00:28:46 2011] [debug] mod_cache.c(131): Adding CACHE_SAVE
filter for /mod_disk_cache_bug/index.php
[Mon Apr 11 00:28:46 2011] [debug] mod_cache.c(138): Adding CACHE_REMOVE_URL
filter for /mod_disk_cache_bug/index.php
[Mon Apr 11 00:28:46 2011] [debug] mod_deflate.c(602): [client 71.177.216.6]
Zlib: Compressed 19 to 21 : URL /mod_disk_cache_bug/index.php
[Mon Apr 11 00:28:46 2011] [debug] mod_headers.c(663): headers:
ap_headers_output_filter()
[Mon Apr 11 00:28:46 2011] [debug] mod_cache.c(639): cache: Caching url:
/mod_disk_cache_bug/index.php
[Mon Apr 11 00:28:46 2011] [debug] mod_cache.c(645): cache: Removing
CACHE_REMOVE_URL filter.
[Mon Apr 11 00:28:46 2011] [debug] mod_disk_cache.c(962): disk_cache: Stored
headers for URL http://www.t1shopper.com:80/mod_disk_cache_bug/index.php?
[Mon Apr 11 00:28:46 2011] [debug] mod_disk_cache.c(1051): disk_cache: Body
for URL http://www.t1shopper.com:80/mod_disk_cache_bug/index.php? cached.

---= Log from URL #2 (Second Request) =---
[Mon Apr 11 00:30:38 2011] [debug] mod_disk_cache.c(476): disk_cache:
Recalled cached URL info header
http://www.t1shopper.com:80/mod_disk_cache_bug/index.php?
[Mon Apr 11 00:30:38 2011] [debug] mod_disk_cache.c(749): disk_cache:
Recalled headers for URL
http://www.t1shopper.com:80/mod_disk_cache_bug/index.php?
[Mon Apr 11 00:30:38 2011] [debug] mod_cache.c(282): cache: running
CACHE_OUT filter
[Mon Apr 11 00:30:38 2011] [debug] mod_cache.c(296): cache: serving
/mod_disk_cache_bug/index.php

We're on:
httpd-2.2.3-45.el5.centos.x86_64.rpm



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re-use of a Setenv directive

Posted by "David (Dave) Donnan" <da...@thalesgroup.com>.
Oups my test cases weren't tidy.

from vhost443.conf:

        SetEnvIf "LA-U:REMOTE_PORT"               "(.*)"           
        A_SETENVIF_LA_U_REMOTE_PORT=$1
        SetEnvIf %{LA-U:REMOTE_PORT}               "(.*)"          
        A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=$1
        SetEnvIf ${LA-U:REMOTE_PORT}               "(.*)"          
        A_SETENVIF_LA_U_REMOTE_PORT_DOLLAR=$1

        SetEnvIf "LA-F:REMOTE_PORT"               "(.*)"           
        A_SETENVIF_LA_F_REMOTE_PORT=$1
        SetEnvIf %{LA-F:REMOTE_PORT}               "(.*)"          
        A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=$1
        SetEnvIf ${LA-F:REMOTE_PORT}               "(.*)"          
        A_SETENVIF_LA_F_REMOTE_PORT_DOLLAR=$1

        SetEnvIf "ENV:REMOTE_PORT"               "(.*)"            
        A_SETENVIF_ENV_REMOTE_PORT=$1
        SetEnvIf %{ENV:REMOTE_PORT}               "(.*)"           
        A_SETENVIF_ENV_REMOTE_PORT_PERCENT=$1
        SetEnvIf ${ENV:REMOTE_PORT}               "(.*)"           
        A_SETENVIF_ENV_REMOTE_PORT_DOLLAR=$1

        SetEnvIf "SSL:REMOTE_PORT"               "(.*)"            
        A_SETENVIF_SSL_REMOTE_PORT=$1
        SetEnvIf %{SSL:REMOTE_PORT}               "(.*)"           
        A_SETENVIF_SSL_REMOTE_PORT_PERCENT=$1
        SetEnvIf ${SSL:REMOTE_PORT}               "(.*)"           
        A_SETENVIF_SSL_REMOTE_PORT_DOLLAR=$1

        SetenvIf OID("0.9.2342.19200300.100.1.1") "(.*)"           
        A_SETENVIF_OIDTEST=3D$1
        SetenvIf %{OID("0.9.2342.19200300.100.1.1")} "(.*)"        
        A_SETENVIF_OIDTEST_WITH_PERCENT=3D$1
        SetenvIf ${OID("0.9.2342.19200300.100.1.1")} "(.*)"        
        A_SETENVIF_OIDTEST_WITH_DOLLAR=3D$1


And the result from printenv.pl:

        A_SETENVIF_ENV_REMOTE_PORT=""
        A_SETENVIF_ENV_REMOTE_PORT_DOLLAR=""
        A_SETENVIF_ENV_REMOTE_PORT_PERCENT=""
        A_SETENVIF_LA_F_REMOTE_PORT=""
        A_SETENVIF_LA_F_REMOTE_PORT_DOLLAR=""
        A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=""
        A_SETENVIF_LA_U_REMOTE_PORT=""
        A_SETENVIF_LA_U_REMOTE_PORT_DOLLAR=""
        A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=""
        A_SETENVIF_OIDTEST="3D"
        A_SETENVIF_OIDTEST_WITH_DOLLAR="3D"
        A_SETENVIF_OIDTEST_WITH_PERCENT="3D"
        A_SETENVIF_SSL_REMOTE_PORT=""
        A_SETENVIF_SSL_REMOTE_PORT_DOLLAR=""

Cdlt, Dave
-----
A_SETENVIF_SSL_REMOTE_PORT_PERCENT=""



David (Dave) Donnan wrote:
> Sébastien, hello. I don't have a solution for you but I'm waiting for 
> a similar reply.
>
> I hope the following helps:
>
> >From my e-mail thread entitled, 'Setting CGI environment variables, 
> dynamically, from httpd.conf leveraging exising variables':
> ...
> 2. Technique 2: setenv DAVESETENV "text"
> > ----------------------------------------------
> >
> >     Result: DAVESETENV="text"
> >
> > But, I've read that this is only a static string.
> >
> > http://www.usenet-forums.com/apache-web-server/10179-setenv-dynamic-variable.html
>   
> Eric Covenor replied:
>   
>
>         setenvif is a bit more flexible:
>         http://httpd.apache.org/docs/current/mod/mod_setenvif.html#setenvif
>
> ==> So I reckon you should look at setenvif, rather.
>
> ----------
>
> >From my Email entitled, 'RewriteRule .* - [E=TEMP_SMUSER:%{SSL:OID("2.5.29.17")}]  # Subject Alternate Name':
>
> ...
>
> Question 2: Also, I've never gotten SetEnvIf to work, for example:
>   
>
>     SetEnvIf "LA-U:REMOTE_PORT"               "(.*)"           
>     A_SETENVIF_LA_U_REMOTE_PORT=$1
>     SetEnvIf ${LA-U:REMOTE_PORT}               "(.*)"           
>     A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=$1
>
>     SetEnvIf "LA-F:REMOTE_PORT"               "(.*)"           
>     A_SETENVIF_LA_F_REMOTE_PORT=$1
>     SetEnvIf ${LA-F:REMOTE_PORT}               "(.*)"           
>     A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=$1
>
>     SetEnvIf "ENV:REMOTE_PORT"               "(.*)"           
>     A_SETENVIF_ENV_REMOTE_PORT=$1
>     SetEnvIf ${ENV:REMOTE_PORT}               "(.*)"           
>     A_SETENVIF_ENV_REMOTE_PORT_PERCENT=$1
>
>     SetEnvIf "SSL:REMOTE_PORT"               "(.*)"           
>     A_SETENVIF_SSL_REMOTE_PORT=$1
>     SetEnvIf ${SSL:REMOTE_PORT}               "(.*)"           
>     A_SETENVIF_SSL_REMOTE_PORT_PERCENT=$1
>
>     SetenvIf %{OID("0.9.2342.19200300.100.1.1")} "(.*)"           
>     A_SETENVIF_OIDTEST_WITH_PERCENT=3D$1
>     SetenvIf OID("0.9.2342.19200300.100.1.1") "(.*)"           
>     A_SETENVIF_OIDTEST=3D$1
>
> Result:
>
>     A_SETENVIF_ENV_REMOTE_PORT=""
>     A_SETENVIF_ENV_REMOTE_PORT_PERCENT=""
>     A_SETENVIF_LA_F_REMOTE_PORT=""
>     A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=""
>     A_SETENVIF_LA_U_REMOTE_PORT=""
>     A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=""
>     A_SETENVIF_OIDTEST="3D"
>     A_SETENVIF_OIDTEST_WITH_PERCENT="3D"
>     A_SETENVIF_SSL_REMOTE_PORT=""
>       
>
>
> If I receive an answer I'll let you know.
>
> Cdlt, Dave
> -----
>   
> Sébastien Moretti wrote:
>> Hi
>>
>> I have defined a SetEnv Directive this way:
>>     SetEnv BASE_PATH /tmp/smthg
>>
>> I would like to re-use this variable in another SetEnv Directive, e.g.:
>>     SetEnv PATHS $BASE_PATH/a:$BASE_PATH/b:$BASE_PATH/c:...
>>
>>
>> But $BASE_PATH is not interpreted as a variable.
>> I tried with quotes, back-splash, ...
>>
>>
>> How can I re-use this variable in another SetEnv Directive ?
>> Thanks
>>
>>
>>
>>
>> Apache 2.2.3, Linux kernel 2.6.18, x86_64
>>
>


Re: [users@httpd] Re-use of a Setenv directive

Posted by Sébastien Moretti <se...@unil.ch>.
Hello Dave,

thanks for your help.

In fact, I just want to define BASE_PATH in order to re-use it in PATHS.
PATHS contains several times BASE_PATH and I would like to change 
BASE_PATH value once instead of several times in PATHS.

> Sébastien, hello. I don't have a solution for you but I'm waiting for a
> similar reply.
>
> I hope the following helps:
>
>  From my e-mail thread entitled, 'Setting CGI environment variables,
> dynamically, from httpd.conf leveraging exising variables':
> ...
>
> 2. Technique 2: setenv DAVESETENV "text"
>>  ----------------------------------------------
>>
>>          Result: DAVESETENV="text"
>>
>>  But, I've read that this is only a static string.
>>
>>  http://www.usenet-forums.com/apache-web-server/10179-setenv-dynamic-variable.html
>
> Eric Covenor replied:
>
>         setenvif is a bit more flexible:
>         http://httpd.apache.org/docs/current/mod/mod_setenvif.html#setenvif
>
> ==>  So I reckon you should look at setenvif, rather.
>
> ----------
>
>  From my Email entitled, 'RewriteRule .* - [E=TEMP_SMUSER:%{SSL:OID("2.5.29.17")}]    # Subject Alternate Name':
>
> ...
>
> Question 2: Also, I've never gotten SetEnvIf to work, for example:
>
>     SetEnvIf "LA-U:REMOTE_PORT" "(.*)" A_SETENVIF_LA_U_REMOTE_PORT=$1
>     SetEnvIf ${LA-U:REMOTE_PORT} "(.*)"
>     A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=$1
>
>     SetEnvIf "LA-F:REMOTE_PORT" "(.*)" A_SETENVIF_LA_F_REMOTE_PORT=$1
>     SetEnvIf ${LA-F:REMOTE_PORT} "(.*)"
>     A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=$1
>
>     SetEnvIf "ENV:REMOTE_PORT" "(.*)" A_SETENVIF_ENV_REMOTE_PORT=$1
>     SetEnvIf ${ENV:REMOTE_PORT} "(.*)" A_SETENVIF_ENV_REMOTE_PORT_PERCENT=$1
>
>     SetEnvIf "SSL:REMOTE_PORT" "(.*)" A_SETENVIF_SSL_REMOTE_PORT=$1
>     SetEnvIf ${SSL:REMOTE_PORT} "(.*)" A_SETENVIF_SSL_REMOTE_PORT_PERCENT=$1
>
>     SetenvIf %{OID("0.9.2342.19200300.100.1.1")} "(.*)"
>     A_SETENVIF_OIDTEST_WITH_PERCENT=3D$1
>     SetenvIf OID("0.9.2342.19200300.100.1.1") "(.*)" A_SETENVIF_OIDTEST=3D$1
>
> Result:
>
>     A_SETENVIF_ENV_REMOTE_PORT=""
>     A_SETENVIF_ENV_REMOTE_PORT_PERCENT=""
>     A_SETENVIF_LA_F_REMOTE_PORT=""
>     A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=""
>     A_SETENVIF_LA_U_REMOTE_PORT=""
>     A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=""
>     A_SETENVIF_OIDTEST="3D"
>     A_SETENVIF_OIDTEST_WITH_PERCENT="3D"
>     A_SETENVIF_SSL_REMOTE_PORT=""
>
>
>
> If I receive an answer I'll let you know.
>
> Cdlt, Dave
>
> -----
>
> Sébastien Moretti wrote:
>> Hi
>>
>> I have defined a SetEnv Directive this way:
>> SetEnv BASE_PATH /tmp/smthg
>>
>> I would like to re-use this variable in another SetEnv Directive, e.g.:
>> SetEnv PATHS $BASE_PATH/a:$BASE_PATH/b:$BASE_PATH/c:...
>>
>>
>> But $BASE_PATH is not interpreted as a variable.
>> I tried with quotes, back-splash, ...
>>
>>
>> How can I re-use this variable in another SetEnv Directive ?
>> Thanks
>>
>>
>>
>>
>> Apache 2.2.3, Linux kernel 2.6.18, x86_64

-- 
Sébastien Moretti
Department of Ecology and Evolution,
Biophore, University of Lausanne,
CH-1015 Lausanne, Switzerland
Tel.: +41 (21) 692 4221/4079
http://bioinfo.unil.ch/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re-use of a Setenv directive

Posted by "David (Dave) Donnan" <da...@thalesgroup.com>.
Sébastien, hello. I don't have a solution for you but I'm waiting for a 
similar reply.

I hope the following helps:

 From my e-mail thread entitled, 'Setting CGI environment variables, 
dynamically, from httpd.conf leveraging exising variables':
...

2. Technique 2: setenv DAVESETENV "text"
> ----------------------------------------------
>
>     Result: DAVESETENV="text"
>
> But, I've read that this is only a static string.
>
> http://www.usenet-forums.com/apache-web-server/10179-setenv-dynamic-variable.html

Eric Covenor replied:

        setenvif is a bit more flexible:
        http://httpd.apache.org/docs/current/mod/mod_setenvif.html#setenvif

==> So I reckon you should look at setenvif, rather.

----------

>From my Email entitled, 'RewriteRule .* - [E=TEMP_SMUSER:%{SSL:OID("2.5.29.17")}]  # Subject Alternate Name':

...

Question 2: Also, I've never gotten SetEnvIf to work, for example:

    SetEnvIf "LA-U:REMOTE_PORT"               "(.*)"           
    A_SETENVIF_LA_U_REMOTE_PORT=$1
    SetEnvIf ${LA-U:REMOTE_PORT}               "(.*)"           
    A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=$1

    SetEnvIf "LA-F:REMOTE_PORT"               "(.*)"           
    A_SETENVIF_LA_F_REMOTE_PORT=$1
    SetEnvIf ${LA-F:REMOTE_PORT}               "(.*)"           
    A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=$1

    SetEnvIf "ENV:REMOTE_PORT"               "(.*)"           
    A_SETENVIF_ENV_REMOTE_PORT=$1
    SetEnvIf ${ENV:REMOTE_PORT}               "(.*)"           
    A_SETENVIF_ENV_REMOTE_PORT_PERCENT=$1

    SetEnvIf "SSL:REMOTE_PORT"               "(.*)"           
    A_SETENVIF_SSL_REMOTE_PORT=$1
    SetEnvIf ${SSL:REMOTE_PORT}               "(.*)"           
    A_SETENVIF_SSL_REMOTE_PORT_PERCENT=$1

    SetenvIf %{OID("0.9.2342.19200300.100.1.1")} "(.*)"           
    A_SETENVIF_OIDTEST_WITH_PERCENT=3D$1
    SetenvIf OID("0.9.2342.19200300.100.1.1") "(.*)"           
    A_SETENVIF_OIDTEST=3D$1

Result:

    A_SETENVIF_ENV_REMOTE_PORT=""
    A_SETENVIF_ENV_REMOTE_PORT_PERCENT=""
    A_SETENVIF_LA_F_REMOTE_PORT=""
    A_SETENVIF_LA_F_REMOTE_PORT_PERCENT=""
    A_SETENVIF_LA_U_REMOTE_PORT=""
    A_SETENVIF_LA_U_REMOTE_PORT_PERCENT=""
    A_SETENVIF_OIDTEST="3D"
    A_SETENVIF_OIDTEST_WITH_PERCENT="3D"
    A_SETENVIF_SSL_REMOTE_PORT=""
      


If I receive an answer I'll let you know.

Cdlt, Dave

-----

Sébastien Moretti wrote:
> Hi
>
> I have defined a SetEnv Directive this way:
>     SetEnv BASE_PATH /tmp/smthg
>
> I would like to re-use this variable in another SetEnv Directive, e.g.:
>     SetEnv PATHS $BASE_PATH/a:$BASE_PATH/b:$BASE_PATH/c:...
>
>
> But $BASE_PATH is not interpreted as a variable.
> I tried with quotes, back-splash, ...
>
>
> How can I re-use this variable in another SetEnv Directive ?
> Thanks
>
>
>
>
> Apache 2.2.3, Linux kernel 2.6.18, x86_64
>


Re: [users@httpd] Re-use of a Setenv directive

Posted by Rainer Jung <ra...@kippdata.de>.
On 20.10.2010 17:04, Igor Galić wrote:
>
> ----- "J.Lance Wilkinson"<jl...@psulias.psu.edu>  wrote:
>
>> Rainer Jung wrote:
>>> If the values are in fact static, i.e. do not depend in the request,
>>
>>> virtual host etc., you can actually use the fact, that Apache allows
>> you
>>> to resolve unix environment variables (not the same as Apache
>>> environment variables) inside the Apache configuration. The syntax
>> is
>>> ${VARNAME} (do not drop the curly braces).
>>>
>>> - Set env var outside of Apache before starting:
>>>
>>> BASE_PATH=/var/smthg
>>> export BASE_PATH
>>>
>>> Use variable inside Apache config:
>>>
>>> SetEnv PATHS ${BASE_PATH}/a:${BASE_PATH}/b:${BASE_PATH}/c:...
>>
>> 	Is this post-Apache 2.2.x functionality, or are you talking about
>> 	mod_define to get this functionality?
>
> Nope. That's in 2.2 -- it's (heavily) (ab)used by Distros like
> Debian and their like.

... and it was finally documented after being a secret for many years:

http://httpd.apache.org/docs/2.2/configuring.html#syntax

> Also, what's mod_define?

That's a module that lets your define variables inside Apache 
configuration. They are resolved with the same syntax ${XXX}. The 
difference to the shell environment variables is, that

- you can redefine (change config) and do (graceful) restart.
   This won't work for shell variables, because all children are still 
forked from the same original parent process, which hasn't changes its 
environment

- you can use the features of the normal config files (include etc) and 
define the variables closer to were you use them.

mod_define was part of the 1.3 mod_ssl written by Ralf Engelschall. I 
ported it to 2.x and offered to include into trunk some time ago. At 
least Stefan Fritsch liked the idea :)

One minor problem: The ${xxx} syntax clashes with RewriteMap syntax.

You can find the port at

http://people.apache.org/~rjung/mod_define/

Feedback welcome.

Regards,

Rainer

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re-use of a Setenv directive

Posted by Igor Galić <i....@brainsware.org>.
----- "J.Lance Wilkinson" <jl...@psulias.psu.edu> wrote:

> Rainer Jung wrote:
> > If the values are in fact static, i.e. do not depend in the request,
> 
> > virtual host etc., you can actually use the fact, that Apache allows
> you 
> > to resolve unix environment variables (not the same as Apache 
> > environment variables) inside the Apache configuration. The syntax
> is 
> > ${VARNAME} (do not drop the curly braces).
> > 
> > - Set env var outside of Apache before starting:
> > 
> > BASE_PATH=/var/smthg
> > export BASE_PATH
> > 
> > Use variable inside Apache config:
> > 
> > SetEnv PATHS ${BASE_PATH}/a:${BASE_PATH}/b:${BASE_PATH}/c:...
> 
> 	Is this post-Apache 2.2.x functionality, or are you talking about
> 	mod_define to get this functionality?

Nope. That's in 2.2 -- it's (heavily) (ab)used by Distros like
Debian and their like.

Also, what's mod_define?

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re-use of a Setenv directive

Posted by "J.Lance Wilkinson" <jl...@psulias.psu.edu>.
Rainer Jung wrote:
> If the values are in fact static, i.e. do not depend in the request, 
> virtual host etc., you can actually use the fact, that Apache allows you 
> to resolve unix environment variables (not the same as Apache 
> environment variables) inside the Apache configuration. The syntax is 
> ${VARNAME} (do not drop the curly braces).
> 
> - Set env var outside of Apache before starting:
> 
> BASE_PATH=/var/smthg
> export BASE_PATH
> 
> Use variable inside Apache config:
> 
> SetEnv PATHS ${BASE_PATH}/a:${BASE_PATH}/b:${BASE_PATH}/c:...

	Is this post-Apache 2.2.x functionality, or are you talking about
	mod_define to get this functionality?

-- 
J.Lance Wilkinson ("Lance")		InterNet: Lance.Wilkinson@psu.edu
Systems Design Specialist - Lead	Phone: (814) 865-4870
Digital Library Technologies		FAX:   (814) 863-3560
E3 Paterno Library
Penn State University
University Park, PA 16802

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re-use of a Setenv directive

Posted by Sébastien Moretti <se...@unil.ch>.
>> Hi
>>
>> I have defined a SetEnv Directive this way:
>> SetEnv BASE_PATH /tmp/smthg
>>
>> I would like to re-use this variable in another SetEnv Directive, e.g.:
>> SetEnv PATHS $BASE_PATH/a:$BASE_PATH/b:$BASE_PATH/c:...
>>
>>
>> But $BASE_PATH is not interpreted as a variable.
>> I tried with quotes, back-splash, ...
>>
>>
>> How can I re-use this variable in another SetEnv Directive ?
>> Thanks
>
> You should be able to do this via:
>
> - Use a RewriteCond to match against the BASE_PATH variable
> - Use a RewriteRuke with an ENV= flag to set PATHS using the back
> reference to the matched variable
>
> Clumsy, but should work.
>
> If the values are in fact static, i.e. do not depend in the request,
> virtual host etc., you can actually use the fact, that Apache allows you
> to resolve unix environment variables (not the same as Apache
> environment variables) inside the Apache configuration. The syntax is
> ${VARNAME} (do not drop the curly braces).
>
> - Set env var outside of Apache before starting:

It does exactly what I want.
But I cannot do it automatically if apache is started automatically at 
boot time. Except if I add this in /etc/init.d/httpd2 script but will 
have to re-do it each time apache is updated.

> BASE_PATH=/var/smthg
> export BASE_PATH
>
> Use variable inside Apache config:
>
> SetEnv PATHS ${BASE_PATH}/a:${BASE_PATH}/b:${BASE_PATH}/c:...
>
> or
>
> <Directory ${BASE_PATH}/somesubdir>
>
> etc.
>
> Regards,
>
> Rainer

-- 
Sébastien Moretti
Department of Ecology and Evolution,
Biophore, University of Lausanne,
CH-1015 Lausanne, Switzerland

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re-use of a Setenv directive

Posted by Rainer Jung <ra...@kippdata.de>.
On 20.10.2010 14:49, Sébastien Moretti wrote:
> Hi
>
> I have defined a SetEnv Directive this way:
> SetEnv BASE_PATH /tmp/smthg
>
> I would like to re-use this variable in another SetEnv Directive, e.g.:
> SetEnv PATHS $BASE_PATH/a:$BASE_PATH/b:$BASE_PATH/c:...
>
>
> But $BASE_PATH is not interpreted as a variable.
> I tried with quotes, back-splash, ...
>
>
> How can I re-use this variable in another SetEnv Directive ?
> Thanks

You should be able to do this via:

- Use a RewriteCond to match against the BASE_PATH variable
- Use a RewriteRuke with an ENV= flag to set PATHS using the back 
reference to the matched variable

Clumsy, but should work.

If the values are in fact static, i.e. do not depend in the request, 
virtual host etc., you can actually use the fact, that Apache allows you 
to resolve unix environment variables (not the same as Apache 
environment variables) inside the Apache configuration. The syntax is 
${VARNAME} (do not drop the curly braces).

- Set env var outside of Apache before starting:

BASE_PATH=/var/smthg
export BASE_PATH

Use variable inside Apache config:

SetEnv PATHS ${BASE_PATH}/a:${BASE_PATH}/b:${BASE_PATH}/c:...

or

<Directory ${BASE_PATH}/somesubdir>

etc.

Regards,

Rainer

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org