[Xapian-discuss] Dreaded "Premature end of script headers: omega"...

Jim jim at fayettedigital.com
Tue May 6 18:38:26 BST 2008

Olly Betts wrote:
> On Mon, May 05, 2008 at 08:57:42PM -0300, Bill Hutten wrote:
>> I've (almost) successfully setup Xapian and Omega on a Linux machine -  
>> the index has been created successfully, and using omega from the  
>> command line works perfectly...
> OK, that's good so far.
>> However - it's not working as a CGI - I consistently get "Premature  
>> end of script headers: omega" in the Apache error log.
> In case you aren't aware, this generally means "script died before
> writing any output" (strictly speaking, before writing a blank line to
> end the headers, but it's rare to die halfway through the headers for
> a CGI which works elsewhere.
>> I've placed the "omega" executable in the cgi-bin directory, along  
>> with the "omega.conf" file.  (Is the .conf file required to be  
>> "beside" the omega executable)?
> It's not *required* to be there, but that is one of the places it can
> be.  For more details, see the "omega configuration" section here:
> http://xapian.org/docs/omega/overview.html
>> I've also checked permissions - my  
>> cgi-bin directory is owned by "southshore.psaserv", as is the omega  
>> executable and the omega.conf.
>> I'm obviously missing something... anyone care to point it out to me?   
>> I've checked the mailing list archives and the only suggestion was to  
>> make sure that the permissions on the omega executable matched the  
>> permissions on the cgi-bin directory - but they seem to match fine...
> You've already ruled out the Omega-specific parts (since Omega runs from
> the command line), so it's really an exercise in generic CGI debugging
> at this point.  Unfortunately, this sort of thing isn't easy to debug
> remotely as I don't know anything about how your server is set up.
> You need to look at differences between your environment and that
> which the CGI gets run as from the webserver.  Environment variables
> are one issue.  Another is the user/group which runs CGI scripts.
> Some things to check:
> * If you're able, try running omega *as the user which runs CGI scripts*
>   from your shell (e.g. using su).  You'll probably need root access for
>   that though.
> * Is the omega CGI binary readable and executable by the user which CGI
>   scripts run as?
> * Did you symlink the omega binary to the CGI directory?  Some servers
>   don't like symlinked CGI scripts.
> * Write a simple CGI script to dump environment variables and put it in
>   the same CGI directory as omega, with the same permissions.  Assuming
>   it runs, compare output with printenv in your shell.  Something as
>   simple as this will probably do:
> #!/bin/sh
> echo "Content-Type: text/plain"
> echo
> printenv
>   Consider any differences carefully, but one particular thing to looks
>   for - Omega should get an rpath set if xapian-core isn't on the
>   standard library search path, but if you needed to set LD_LIBRARY_PATH
>   for some reason, you'll need to ensure that this is set when it is run.
It shouldn't cause this error, but you may want to change the name to 
omega.cgi and try it.  Some apache configurations want cgi scripts to 
have the extension cgi.

I had this problem with a Debian install a while back.  For some reason 
Apache never would actually execute a program.  I finally gave up after 
a couple of weeks and installed Ubuntu instead. 


More information about the Xapian-discuss mailing list