RewriteLock hangs Apache on re-start when added to an otherwise working Rewrite / Rewritemap -
i on network solutions vps, 4 domain names share ip. have rewrite / rewritemap set works. rewrite in file example.com web address @ var/www/vhosts/example.com/conf/vhost.conf, rewrite being thing in vhost.conf file. not work in main httpd.conf file server.
the rewritemap uses couple things in url typed in user (http://example.com/bb/cc) third piece of info (aa) matching database record, uses third piece of info query string load file, , leaves typed in url in address bar while showing file based on query string aa.
here rewrite:
options +followsymlinks rewriteengine on rewritemap newurl "prg://var/www/cgi-bin/examplemap.php" rewriterule ^/(example/.*) ${newurl:$1} [l] when add following either above or below rewritemap line:
rewritelock /var/lock/mapexamplelock and try re-start apache, hangs , apache not re-start. have tried different file paths (thinking might permissions issue , hoping worked of course), taking away initial /, putting in quotes, different file types (ie. .txt @ end), different file names, anything, , every time hangs apache on re-start. rewrite / rewritemap works without it, have read lot on importance of rewritelock, , php issuing warnings in log ending in dangerous not use rewritelock.
here map (located rewrite says):
#!/usr/bin/php <?php include '/pathtodatabase'; set_time_limit(0); $keyboard = fopen("php://stdin","r"); while (1) { $line = fgets($keyboard); if (preg_match('/(.*)\/(.*)/', $line, $igot)) { $getalias = mysql_query("select aa `table`.`dbase` bb = '$igot[1]' && cc = '$igot[2]'"); while($row=mysql_fetch_array($getalias)) { $arid = $row['aa']; } print "/file-to-take-load.php?aa=$arid\n"; } else { print "$line\n"; } } ?> i looked in main httpd.conf file , there nothing can find rewritelock might interfering. it's standard 1 came in set-up of vps.
if has idea why work without rewritelock , possible fix, appreciated.
thanks greg
apache hangs if define more 1 rewritelock directives or if use in vhost config.
rewritelock should specified @ server config level , once. lock file used prg type maps. if want use multiple prg maps, suggest using internal locking mechanism, example in php there flock function, , ignore warning apache writes in error log.
see here more info:
http://books.google.com/books?id=huptymf8-aec&lpg=pp1&pg=pa298#v=onepage&q&f=false
Comments
Post a Comment