Skip to content


Subversion checkout URL

You can clone with
Download ZIP
dropbox-like file synchronization for your own server (proof of concept)
PHP Shell
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


dbc - dropbox-like file synchronization for your own server

this is an attempt to create a file synchronization tool that mimes the
behavior of dropbox. dbc synchronizes a specified folder on your system with a
folder on your server. your local folder is being watched for changes by the
dbc client. everytime you add, delete or modify files, the changes are
synchronized with the server. the dbc client can run on multiple systems
simultaneously, each of them watching a local folder. changes made on one
system are distributed to all connected clients on the network.

this is a PROOF OF CONCEPT i wrote for myself to learn about this kind of file
synchronization. this software is far from being complete. it is poorly tested
and may lead to data loss. i am sure there are some major security glitches.
use at your own risk.

:: requirements ::

 * client: php-cli 5.3 with modules curl, pcntl, posix
 * server: apache with php 5.3

tested on osx 10.7 and debian linux.

the php build that ships with osx does not provide pcntl_fork, so if you want
to use dbc client on osx, you will have to build php by hand. i recommend using

 * sudo port selfupdate && sudo port upgrade outdated
 * sudo port install php5 +no_web +pear
 * sudo port install php5-pcntl php5-posix php5-curl

on linux (debian, ubuntu):

 * sudo apt-get update && sudo apt-get upgrade
 * sudo apt-get install php5-cli php5-curl

:: server configuration ::

copy the contents of this folder to a new folder (let's call it dbc) to your
"htdocs" folder of your server.

rename the file "serverconfig.sample.php" to "serverconfig.php" and edit the
file. set the variable "baseDir" to the directory, where the data should be
stored, e.g. "/opt/dbcdata/". the folder must be readable and writeable by the
apache user. create the base-dir with "mkdir /opt/dbcdata/".

now use the commandline tool dbcserver.php to create a new user:

dbcserver.php adduser peter secretpassword

this will create the user "peter" with the password "secretpassword".

if you access the server url (e.g. you should see the
message "SERVER_OK".

security considerations: you should use ssl. you should set up a dedicated user
and group for dbc. use at your own risk. the server only requires the files
index.php, Server*, FileList* and serverconfig.php. delete all other files.

:: client configuration ::

start the client using the commandline client dbc.php:

dbc.php /home/peter/syncfolder

the second parameter is the folder you want to watch. if you want to initialize
a new folder, you must specify a folder that does not exist.

the client will ask for the server url (e.g.,
and username and password. after this, you should be able to use your
syncfolder. quit the client with ctrl+c.

:: files ::

dbc.php                 : dbc commandline tool for the Client
Client*.class.php       : Client classes used by dbc.php
index.php               : index document for apache that responds to client requests
dbcserver.php           : dbc commandline tool for the Server
Server*.class.php       : Server classes used by index.php
FileList.class.php      : filelist class used by client and server
serverconfig.sample.php : server configuration file, edit and move to serverconfig.php
tests/                  : folder with some unit tests for development


by sebastian volland

Something went wrong with that request. Please try again.