Hi there,
I am trying to set up a SabreDAV server on my server - or rather my
hosting service's server.
I keep running into problems, until now all I managed to do was
setting up the server and getting the WebInterface to run, my WebDAV
client does not work, reporting a "Access Forbidden" Error, Charles
says, that I am "out of base uri" which I don't understand. I am
pretty new to php and don't know anything about apache, so I just
"tried" around...
I have a site called
mysite.com, I made a folder
mysite.com/DAV where
I put the SabreDAV lib folder + a folder "public" + "data"
I put a "index.php" on
mysite.com/DAV/
the content of my index.php is
<?php
// !!!! Make sure the Sabre directory is in the include_path !!!
// example:
set_include_path('lib/' . PATH_SEPARATOR . get_include_path());
/*
This is the best starting point if you're just interested in setting
up a fileserver.
Make sure that the 'public' and 'tmpdata' exists, with write
permissions
for your server.
*/
// settings
date_default_timezone_set('Canada/Eastern');
$publicDir = 'public';
$tmpDir = 'data';
// If you want to run the SabreDAV server in a custom location (using
mod_rewrite for instance)
// You can override the baseUri here.
$baseUri = '/DAV/';
// Files we need
require_once 'Sabre/autoload.php';
// Create the root node
$root = new Sabre_DAV_FS_Directory($publicDir);
// The rootnode needs in turn to be passed to the server class
$server = new Sabre_DAV_Server($root);
if (isset($baseUri))
$server->setBaseUri($baseUri);
// Support for LOCK and UNLOCK
$lockBackend = new Sabre_DAV_Locks_Backend_FS($tmpDir);
$lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
$server->addPlugin($lockPlugin);
// Support for html frontend
$browser = new Sabre_DAV_Browser_Plugin();
$server->addPlugin($browser);
// Temporary file filter
$tempFF = new Sabre_DAV_TemporaryFileFilterPlugin($tmpDir);
$server->addPlugin($tempFF);
// And off we go!
$server->exec();
?>
This appears to be enough to make the Browser Plugin work, I can
create files and upload/download them. Great.
So I tried mounting it:
dav://
mysite.com/DAV/ ->
<d:error xmlns:d="DAV:" xmlns:s="
http://sabredav.org/ns">
<s:exception>Sabre_DAV_Exception_Forbidden</s:exception>
<s:message>Requested uri (/) is out of base uri (/DAV/)</s:message>
<s:sabredav-version>1.2.4</s:sabredav-version>
</d:error>
and
dav://
mysite.com/DAV/index.php/ ->
<d:error xmlns:d="DAV:" xmlns:s="
http://sabredav.org/ns">
<s:exception>Sabre_DAV_Exception_Forbidden</s:exception>
<s:message>Requested uri (/) is out of base uri (/DAV/)</s:message>
<s:sabredav-version>1.2.4</s:sabredav-version>
</d:error>
and finally
dav://
mysite.com/DAV/public/ ->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="
http://mysite.com/DAV/
public/">here</a>.</p>
<hr>
<address>Apache/2.2.8 (Linux/SUSE) Server at
arne-am-ende.de Port 80</
address>
</body></html>
So there seems to be something wrong with my URIs. I changed the
baseuri to "/" which WORKS, but gives me Access to a folder in
mysite.com/DAV/public/DAV which I created earlier for testing purposes
(don't remember why) and I REALLY don't get why it leads me there.
So I guessed it must have something to do with .htaccess files.
Now, i don't want to pretend, that I understand these. I just copied
them from somewhere here and played around with them:
I put one in
mysite.com/.htaccess containing
RewriteEngine on
RewriteRule ^(.+) /DAV/index.php [L]
and one in
mysite.com/DAV/.htaccess containing
RewriteEngine on
RewriteRule ^(.+) index.php [L]
It would be great if I could get this to work. However, I also didn't
get the digestauth method to work (even though I am fairly confident I
produced the correct .htdigest file, and the calendarplugin wouldn't
let me login with admin admin
Is there even the possibility to make all of thiw work, without having
root access to the server? Almost every solution for related problems
I find here involves some change in apache's configs...
Thanks in advance
Arne