mod rewrite - Understanding Apache RewriteMap with RewriteLock -
mod rewrite - Understanding Apache RewriteMap with RewriteLock -
i've taken on development of heavy-duty lamp application. original dev used .htaccess file rewritemap , php script handle conditions of app.
specifically, when subdomain patterns requested client, rewritemap catches them , sends them appropriate application module.
i'm quite comfortable typical mod_rewrite redirects, , think i've got basic rewritemap concept figured out; i'm struggling find decent documentation on how rewritelock works. according apache docs:
this directive sets filename synchronization lockfile mod_rewrite needs communicate rewritemap programs. set lockfile local path (not on nfs-mounted device) when want utilize rewriting map-program. not required other types of rewriting maps.
but still little vague me. whats exact purpose , function of rewritelock , how work?
rewritelock used prg:
keyword. rewritemap can used several keywords, utilize text files (txt:
), hashfiles (dbm:
), randomized text (rnd:
) or external mapping scripts ( 1 prg:
keyword ). in mode external script launched when apache start. every incoming request, when mod-rewrite calling prg:
mapping, apache sends input script , reads output stream value.
rewritelock must used in case prevent parallel requests (so parallel inputs external process) mix answers on process standard output. it's locking mechanism (a file, given path, classical token, 1 user) enforce serialization of calls external mapping script. imho should transparently applied mod-rewrite when using prg: never found prg case locking thing not mandatory.
edit:
well in fact utilize external prg: without rewritelock if randomization of output not problem, i.e. given entry can response given entry, in script doing advanced rnd:, own round-robin service. if output must reflect entry, need semaphore, of course of study can slow downwards rewritemap process.
so if you're using hashmap or textmap not need set rewritelock.
edit:
you may find useful details on thread, fact lock file exists few milliseconds, when apache calls prg , waits answer.
edit: on question 1 unusual fact is:
the original dev used .htaccess file rewritemap
this unusual because rewritemap cannot work on .htaccess files, .htaccess configuration entries read dynamically , rewritemap stated here in context line can set in main configuration or in virtualhost configuration. cannot in location, directory or .htaccess. chances never work in .htaccess.
now @puk asked illustration of rewritemap usage. well, searching "rewritemap" in stack overflow show several real examples:
here in question here list of illustration in answer another here apache mod-rewrite lamp
Comments
Post a Comment