Forum Moderators: phranque
I am using mod_rewrite but lock file won't create.... don't know if i am doing anything wrong....
I am using:
Apache-2.2.3
under Linux RedHat 2.4.21-27.0.1.EL
what i did... :
downloaded apache from apache.org
compiled with
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local --with-zlib-dir=/usr/include --enable-module=rewrite --enable-shared=rewritemake;make install
/usr/local/apache/bin/apxs -i -c -a /usr/local/httpd-2.2.3/modules/mappers/mod_rewrite.c
then edit httpd.conf
RewriteEngine on
RewriteLock /usr/local/ahl/ahl.lock
RewriteMap ahl prg:/usr/local/ahl/ahl
RewriteCond %{REMOTE_HOST}::%{DOCUMENT_ROOT} (.*)
RewriteRule (.*) ${ahl:\:\:\:\:$1\:\:%1\:\:%{HTTP_REFERER}} [PT]
the directory /usr/local/ahl has permission 777 for testing purposes.
but ahl.lock still dont exist... don't know why..
Anyone please?
Thanks a lot!
Wilson
The lock file probably won't exist unless a process is actively using the RewriteMap -- It is used a semaphore to force single-threaded use of mapping scripts used by RewriteMap. So, you will probably need to be generating dozens or even hundreds of requests per second that require the RewriteMap function to actually see the file.
Jim
Again, do you have a functional problem, or is this just curiosity here? If you want to make sure that the lock file is being created, write a server script to check that file for existence 100 times per second and log the result, and write a client-side script to request the specific resource URLs rewritten by RewriteMap as fast as possible from the server. If you run those two scripts for a few minutes, you should see the lock file winking in and out of existence in the first script's log file. Due to sampling error, it won't show a true 'log' of the file existence, but will give some indication of the activity.
I suppose another alternative is to add code to your RewriteMap script to delay it for 200 milliseconds before it exits -- That would make the lock file exist for a longer period of time, and perhaps you could catch it more easily that way. If you just want proof, then delay your RewriteMap script exit for five seconds -- That'll bring your server to its knees, but you'll likely be able to see the lock file that way, even just doing manual FTP directory-view checks.
Jim