ht://Dig is normally run as a CGI script ("normally" meaning "by everyone who doesn't use PHP3!"). To run the search program from PHP, you will need a file called htdig.sh which looks like this:
Just change the value of HTBINDIR to whatever is appropriate for your setup (i.e. the path you picked for CGIBIN_DIR in the CONFIG file when you installed ht://Dig).
I recommend putting this file in the search/ subdirectory as well, along with the template files. You also need to change file permissions so htdig.sh is executable by your web server.
Next, we need to get PHP to talk to the search script. Finally, some PHP code! This is simply a matter of building the query string to pass to htdig.sh, executing the search, and parsing the results.
$HTSEARCH_PROG is the location of the
htdig.sh program. $search is passed from the form, and is the list of words to search for. $config tells ht://Dig which .conf file to use, and $format tells it which template map to use from the .conf file.