无法配置SabreDAV来测试Webdav和CardDAV

时间:2014-04-09 15:35:21

标签: sabredav

我遵循的步骤:

  1. 下载了Sabredav zip文件 - 解压缩。
  2. 已下载apache webserver 2.2和PHP 5.3
  3. 然后按照“开始使用”中提到的说明进行操作。 Sabredav网站上的一节。
  4. 创建'数据和公共' fiels(位于/ sabredav / vendor /)
  5. 创建了server.php文件(位于/ sabredav / vendor /中)
  6. 现在尝试在浏览器中打开server.php文件 -
  7. 这里使用文件协议打开.. 无法在预期中打开 - ' http://mydomain/sabredav/server.php 有人可以帮帮我吗?

    由于

1 个答案:

答案 0 :(得分:0)

在server.php中,使用浏览器插件查看公用文件夹中的文件。 您的服务器必须是这样的:

include 'SabreDAV/vendor/autoload.php';
use
    Sabre\DAV;
$rootDirectory = new DAV\FS\Directory('public');

// The server object is responsible for making sense out of the WebDAV protocol
$server = new DAV\Server($rootDirectory);

// If your server is not on your webroot, make sure the following line has the correct information

$server->setBaseUri('/server.php'); // if its in some kind of home directory

// The lock manager is reponsible for making sure users don't overwrite each others changes. Change 'data' to a different 
// directory, if you're storing your data somewhere else.
$lockBackend = new DAV\Locks\Backend\File('data/locks');
$lockPlugin = new DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);
$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
$plugin = new \Sabre\DAV\Browser\Plugin();
$server->addPlugin($plugin);
// All we need to do now, is to fire up the server
$server->exec();