[Xapian-discuss] Re: Getting Omega to execute and generate XML
R. Mattes
rm at mh-freiburg.de
Sun Aug 14 14:23:22 BST 2005
On Sun, 14 Aug 2005 14:20:59 +0200, Floris Bos wrote:
Hi Florian,
> Here's my situation:
>
> I've builded Xapian and Omega using Cygwin on my Windows XP configuration.
> I've build my dynamic website using PHP and Mysql and now I'm trying to add
> search functionality with Omega/Xapian as backend. I've been able to
> implement php code that generates a text file (scriptindex input file) and
> run omegascript to put the new document in the Xapian database. This works
> fine.
So far, so good.
> Now I want to request XML from PHP using a predefined omega template but I
> can't get this to work. Can someone be more specific about how to do this
> because I really don't get it. I thought it would be a nice start to try and
> open a template page (the shipped xml template) just to test if everything
> works ok. After that I would change the php script so that it would request
> the output of this page.
>
> I've tried the following:
>
> I've put the xml template in my websites cgi-bin directory. I thought I
> would be able to generate xml by directing my browser to the following url:
> http://localhost/test/cgi-bin/xml?DB=default&P=searchterm1+searchterm2
> (in this 'test' is the name of my website)
There seems to be a missunderstading here. You don't put your templates
into the CGI directory, you put then where ever you configured omega to
look for them -- this is done in the omega.conf file (which a default
omega expects to be in $PREFIX/ect/omega.conf. I have no idea how cygwin
treats/honors $PREFIX). Anyway, there should be a configuration option
'template_dir'. My configuration file looks like this:
database_dir /var/lib/omega/data
template_dir /var/lib/omega/templates
log_dir /var/log/omega
Once this is set up, put your template into the template directory. Now,
put the omega binary int oyour CGI directory and make it executable by the
webserver. To select a specific template just pass the template name
(sans path!) as the FMT parameter to the CGI script.
> When I do this I just get the script from the xml template viewed in my
> browser.
<rant>
Horrors! Your webserver should _never_ send any file as is from the CGI
directory! This is a major security flaw. It should try to execute the
xml and if that fails (and it should :) the server should just send a 500
response.
</rant>
> The script isn't carried out but being displayed in my browser?! Is this
> because I didn't configure Omega the right way or do I need to call
> Omega in a different way than the way I do currently?
See above.
> What files do I need to copy to my cgi-bin directory? I tested with
> copying omega.exe to my cgi-bin dir but I also tried copying the whole
> Omega installation to my cgi-bin dir. It just doesn't work.
Only omega.exe. That's enough. But configure it with 'omega.conf'.
> As I said I'm pretty sure I'm missing out on something very essential
> here (or maybe even more than one thing) but I can't figure it out. I've
> been trying a lot of different things and did hours of reading and
> websearching but I'm running out of options. Is there someone that can
> point me in the right direction?
>
> Any help would be very much appreciated, thanks in advance!!
HTH Ralf Mattes
More information about the Xapian-discuss
mailing list