On 16 Jul 2001, at 12:25, Michael "NightEye" Aeberhard wrote:

> The command line works perfectly for me - but I put the query in quotes and
> specify a config and format, ie:
> 
> ./htsearch "config=myconfig&format=format&words=something"

I suspect it's something I've done with the configure stage:

[dan@xeon:/freebsddiary/www/cgi-bin] $ ./htsearch 
"method=and;format=long;sort=score;config=htdig;restrict=;exclude
=;submit=;words=things"
Content-type: text/html

[dan@xeon:/freebsddiary/www/cgi-bin] $

> Command line works like a charm, but when I call the SAME line from PHP, I
> get this error:
> 
> ht://Dig error
> 
> 
> htsearch detected an error. Please report this to the
> webmaster of this site. The error message is:
> 
> 
> 
> Unable to read word database file
> '/home/sites/site21/local/htdig/db/db.words.db'Did you run htmerge?

Show us ls -l /home/sites/site21/local/htdig/db/db.words.db

> What I'm thinking is that my query from the PHP isn't getting to the
> htsearch.  Here's my PHP code:
> 
> $words = EscapeShellCmd(UrlEncode($search));
> $config = EscapeShellCmd(UrlEncode("roguespear"));
> $format = EscapeShellCmd(UrlEncode("roguespear"));
> $query = "config=$config&words=$words&format=$format";
> 
> $command="/home/sites/site21/local/htdig/bin/htsearch \"$query\"";

I don't call htsearch directly.  I use a wrapper:

   $HTSEARCH_PROG = 
"/home/freebsddiary/configuration/htdig/htdig.sh";

   $command="$HTSEARCH_PROG \"$query\"";
   exec($command,$result);

$ more /home/freebsddiary/configuration/htdig/htdig.sh
#!/bin/sh
#
# This is a php wrapper for use with htdig (http://www.htdig.org/)
# this source code can be obtained from:
#      http://freebsddiary.org/samples/htdig-php-wrapper.tar.gz

#
# HTBINDIR needs to be set to the cgi-bin directory in which htsearch 
resides
#
HTBINDIR=/home/freebsddiary/www/cgi-bin
QUERY_STRING="$@"
REQUEST_METHOD=GET
export QUERY_STRING REQUEST_METHOD
$HTBINDIR/htsearch

> echo $command;
> exec($command,$result);


-- 
Dan Langille
pgpkey - finger [EMAIL PROTECTED] | http://unixathome.org/finger.php

_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a 
subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to