koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-devel] Virtual Hosts / document_root bug


From: Greg Kuhnert
Subject: [Koha-devel] Virtual Hosts / document_root bug
Date: Sat Jan 22 16:30:21 2005
User-agent: Mozilla Thunderbird 0.7 (Windows/20040616)

I was upgrading to the current version of KOHA earlier today, and I found a real nasty one. There are a number of places in the current code base that use $ENV{'DOCUMENT_ROOT'}

For many people, this does not pose a problem. However, if you use apache with directives like those listed below, you might be in for a few problems. Here are the directives I am talking about:

VirtualDocumentRoot /vhosts/%0/docs
VirtualScriptAlias  /vhosts/%0/cgi-bin

The problem I have encountered is documented on the apache website: http://httpd.apache.org/docs/vhosts/mass.html .... An extract is listed below...

The other thing to `fake' is the document root (configured with |DocumentRoot| and available to CGIs via the |DOCUMENT_ROOT| environment variable). In a normal configuration this setting is used by the core module when mapping URIs to filenames, but when the server is configured to do dynamic virtual hosting that job is taken over by another module (either |mod_vhost_alias| or |mod_rewrite|) which has a different way of doing the mapping. Neither of these modules is responsible for setting the |DOCUMENT_ROOT| environment variable so if any CGIs or SSI documents make use of it they will get a misleading value.

In other words, DOCUMENT_ROOT will point to the main document root of the web server, not for the virtual host that koha is installed under.

End result: Koha is broken!

I tried a workaround, and added "SetEnv DOCUMENT_ROOT "/vhosts/koha.no1.com.au/docs" to a .htaccess file, but that didnt help. I think apache prevents over-writing that env variable for security reasons.

The long term fix is going to be to avoid using that environment variable.... If someone here has any better ideas on how to work around this, I'd love to hear from you.

Greg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]