Help!!! HTDIG /Apache Set up

I am just trying to get HTDIG searching from the web site. I can run scripts from the CGI-BIN directory (aside from HTSEARCH), and can run htsearch from the command line.

I get "500 - Premature end of script headers: htsearch" when running from a browser. I know that I must have something wrong in my httpd.conf, but I have no idea what. I'm totally Linux newbie-- so don't kill me on this.

My virtual host is as follows:

NameVirtualHost ip:80
<VirtualHost ip:80>
    Options All +Includes +Multiviews +FollowSymLinks +ExecCGI
    XBitHack On
    AddoutputFilter INCLUDES .html .shtml
    DirectoryIndex index.html
    ServerAdmin webmaster@site.url
    DocumentRoot /var/www/site
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
        <Directory "/var/www/site">
                AllowOverride None
                DAV Off
                Options All +MultiViews +Indexes +Includes FollowSymLinks +ExecCGI
                Order allow,deny
                Allow from all
                AddType text/html .html
                AddoutputFilter INCLUDES .html
                XBitHack On
        <Directory "/var/www/cgi-bin">
                AlloWOverride None
                #Options +Exec
                Options All +MultiViews +ExecCGI -Indexes
                #Order allow,deny
                Allow from all

Any help is greatly appreciated.

Thank You
Who is Participating?
ahoffmannConnect With a Mentor Commented:
> How did you assist me in that?
'cause I assumed that either the PATH and/or the permissions to/on htdig are wrong for user HTTPD, but are correct for another user.
My suggestion does not hit the bulls eye, but it should have shown the right direction.
If you still don't agree, delte the question.
500 error indicates either that your script does not produce a valid header (most likely Content-Type), or that it does not finish within apache's timeout
xybxAuthor Commented:
Great. So what do I do to change either of those? I do believe that the error is related to content, but I do not know what to do about it.
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

probably your htdig index file is not good enough, so that search queries take too long.
First check your servers log-files about error messages, also check htdig's log files.
please post relevant messages.
xybxAuthor Commented:
No, it is not about timeouts. This error occurs so fast, that could not be the problem.

The problem, I can almost guarantee, is in the HTTPD.CONF. 500 is a permissions/execute error. I can search from the command line fine.

Here's the error message (frustrating- I get more details on a Windows box):

Premature end of script headers: htsearch

That's it! I have endlessly searched on this subject, and no one seems to have any details on how to set this up with Apache.

Thanks for your help.
> .. 500 is a permissions/execute error.

> I can search from the command line fine.
ok, does it work if you logged in as the user which is used to run apache itself?
Does the file have read and execute permissions?

As said befor: simply look at your log files, the answer, or at least a hint to it, can be found there.
xybxAuthor Commented:
-HTDIG does not keep log files that I know of. Apache only has 'Premature end of script headers: htsearch' in the log. Searching on that error has not brought me to the answer.
-The file has r+x

The problem is in the Apache config file I am pretty sure-- since it searches from the command line and not on the web site. The error occurrs so fast, that I doubt it has anything to do with HTDIG- and I get a 500 which is some form of internal server error.

did you try from command line when logged in as user that owns/runs httpd?
xybxAuthor Commented:
I ended u solving it another way, but thanks for your help- it ended up being that I had two binaries installed on the system. When I ran it from the command line, of course it worked because it was in the system path. However, the one inside of my cgi-bin was not correct- so I replaced it and it worked.
this is exactly what I told you: login as user which runs httpd
AnnieMod, well done, unambiguous, comment, should be in the list of recommended comments for CVs, Mods, PEs
xybxAuthor Commented:
I'm telling you that I solved the problem myself. Your suggestion to login as the HTTPD user did not solve my problem. My problem was one where I had duplicate copies of the same executable- and didn't think to run them from the local directory. How did you assist me in that?

If I'm wrong, I'll gladly give you the points.
xybxAuthor Commented:
Nah... It is not worth arguing over. I'll accept that you helped with that aspect.

giving an A was more than fair ;-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.