moved from:
http://sourceforge.net/forum/message.php?
msg_id=2212046
(reply to: http://sourceforge.net/forum/message.php?
msg_id=2215420 )
i'd suggest mmcache add a "namespace"
which can config for per-vhost, to cache
sessions/contents cross domain
it's true that cookies cannot cross domain, but
sessionids can transmit by url
and btw: *.example.com can share same cookie
caching content is mostly used by PEAR or other shared
codes
well, i totally agree this feature is at low priority. i also
waiting other bug fixed and hopt mmcache is more
stable :)
=========
scheme A:
short example:
# by $_SERVER['SERVER_NAME']
php_admin_value mmcache.namespace ""
# by string
php_admin_value mmcache.namespace "myserver"
long example:
# "" means "vary by servername"
# this is default value, need not to set here
# php_admin_value mmcache.namespace ""
<VirtualHost 127.0.0.7>
ServerName www.example.net
# by string
php_admin_value mmcache.namespace "ns:example"
DocumentRoot ....
</VirtualHost>
<VirtualHost 127.0.0.7>
ServerName www.example.com
# by string
php_admin_value mmcache.namespace "ns:example"
DocumentRoot ....
</VirtualHost>
<VirtualHost 127.0.0.7>
ServerName abc.example.com
# by string
php_admin_value mmcache.namespace "ns:example"
DocumentRoot ....
</VirtualHost>
<VirtualHost 127.0.0.7>
ServerName www.anotherhost.com
DocumentRoot ....
# this vhost will use default namespace, (vary by
SERVER_NAME)
</VirtualHost>
(http:// in servernames is added by sourceforge)
=======
scheme B:
mmcache_set_namespace('mynamespace');
mmcache_get_ns($key); // $xkey
= "*mynamespace*:$key"
mmcache_get($key); // $xkey = "$_SERVER
[SERVER_NAME]:$key"
notice the * mark in the comment, this make namespace
never destroy SERVER_NAME's data
and will have cross/separate domain at the same time
=======
scheme C:
$oldnamespace = mmcache_set_namespace
('mynamespace');
mmcache_get($key); // $xkey = "*mynamespace*:$key"
mmcache_set_namespace();
mmcache_get($key); // $xkey = "$_SERVER
[SERVER_NAME]:$key"
mmcache_set_namespace($oldnamespace); // restore
scheme C is similar to B, but don't need to implement
*_ns() functions
Logged In: YES
user_id=124551
The "scheme C" is most prefered by me, but it opens a
security hole (anyone can access namespace if he know its
name. It is true for all schemes.)
scheme D:
php.ini
------
mmcache.mapping="www.example1.net=www.example1.com"
mmcache.mapping="www.example1.org=www.example1.com"
mmcache.mapping="www.example2.net=www.example2.com"
mmcache.mapping="www.example2.org=www.example2.com"
------
MMCache will implement "mmcache.mapping" configuration
directive that can be only in "php.ini". it defines the server
name substitution. For example mmcache_get()/put() will use
"www.example2.com" prefix on server www.example2.net".
The servers those are not defined in "mmcache.mapping" will
use there own names.
What do you think about this decision? Any suggestion? May
be the better name for "mmcache.mapping"?
Logged In: YES
user_id=185131
hehe, that's simple for your coding? seems mmcache don't
have any per-vhost or even per-dir config
but mapping don't support MASS-VHOST, which is implement
in apache's mass_vhost.so
well, my scheme C won't open security hole.
you might not noticed that, there is a "*" mark in additonal
"*" . $mynamespace . "*:" . $key
$_SERVER["SERVER_NAME"] . ":" . $key
no one can set to another SERVER_NAME because when he
does, it becomes:
"*www.example.com*:" . $key
not the same as "www.example.com:" . $key
maybe only $mynamespace . "*:" . $key is enough
Logged In: YES
user_id=124551
I is not the problem to use vhost or per-dir config, but in this
case anyone can access not own namespaces.
Mark "*" close the possibility to access to $_SERVER
["SERVER_NAME"] but not to namespace.
Logged In: YES
user_id=185131
sorry, i didn't get your meaning just now
you're right about:
> "anyone can access namespace if he know its
name"
but.. hrm.. seems we're getting into 2 different purpose
we have mmcache_set_namespace() for security datas
and mmcache_set_namespace('...') for shared-data
the idea of "shared" is my goal, not just for 1,2 or 3 domain,
simply like a shared directory that any vhost can read/write in
it
maybe others have more ideas
Logged In: YES
user_id=599881
I modify the Turck MMCache to use a "name_space" option from
php.ini (the option is registered as "PHP_SYSTEM").
Then, I use "php_adminvalue" option in httpd.conf too fix
this value for each domain. All works fine, and I don't see
security problem.
no ?
I sent my modification to 3 of the developpers of the
project
(http://sourceforge.net/project/memberlist.php?group_id=69426).
Logged In: YES
user_id=185131
can u send me one? i'm very insterested in it :)
or Attached file here
remember the checkbox!
Logged In: YES
user_id=599881
I don't kwow how to attach file here, so I made a small zip
file containing the only 2 files modified. You can find it
here :
http://www.boolsite.net/download/turck-mmcache-2.4.6-modification.zip
Logged In: YES
user_id=185131
many thanks!
btw:
press PageDown/End (scroll down)
you'll see
Check to Upload and Attach a File [x] <- check here
[__________] [Browse...] <- file here
File Description:
[__________] <- what is your patch for
just for your info.
your zip file isn't a patch, so don't need to attach here, but
never mind, i'll enjoy it :)