It's very simple.

  • Download this package, and decompress it.
  • The inc folder contains PEAR and the HTTP_WebDAV_Server class.
  • Copy the inc folder and authenticate.php file in the include_path (see php.ini)
  • Copy webdav.php file in the root of your site.

The authenticate.php file contains a digest authentification.

The webdav.php file create a webdav server

<?
include_once("authenticate.php");
 
ini_set("error_reporting", "");
 
# Activate if your PHP is CGI mode
$phpcgi = 0;
# Name of your restricted area
$realm = 'Restricted area Keyphrene';
$DBUSER = "your login";
$DBPWD = "your password";
$users = array($DBUSER => $DBPWD);
# With this authentication method, 
# your password is not readable when you use this service
AuthenticationDigestHTTP($realm, $users, $phpcgi);
# AuthenticationBasicHTTP($realm, $users, $phpcgi);
 
require_once "HTTP/WebDAV/Server/Filesystem.php";
$server = new HTTP_WebDAV_Server_Filesystem();
# Database configuration for the lock method
$server->db_host = $DBHOST;
$server->db_name = $DB_WEBDAV;
$server->db_user = $DBUSER;
$server->db_passwd = $DBPWD;
# Real path of your site
$server->ServeRequest($DOCUMENT_ROOT."/www/");
 
?>

To use this service, you must connect you at this adress http://mysite.org/webdav.php. You can configure a lot of access on your site. Becareful, if you must copy files on your server, you must use the good permissions with the FTP client.

Test your webdav connection with Naja, so create a signet

Now, you can browse on your server with a webdav client

Bookmarks