php based WebDAV server - can be used with any (e.g. free) hosting plans and via standard ports

Hi,

Since this might be of relevance for others, I would like to share this.
Basically, this is user installable php based WebDAV server, that serves 'through' php - in other words, you can use it with hosting plans (read your TOS - some hosting providers explicitly disallow using their services for file storage) with standard php enabled webserver (that's most hosting plans).

This might be useful for people who don't have access to a WebDAV service or (as in my case) whose WebDAV server uses ports that are blocked by their institution's network firewall. It can also be useful for people who don't want to sign up for any paid WebDAV service while there are so many free php enabled hosting packages available.

In order to install it, just simply download the zip file from the location quoted below and upload the contained directory 'zotero' to your website, e.g. to www.example.com/zotero

You must then make sure that the directory 'zotero/data' is writable by the user that runs your php process (ask your hosting service and/or google if you don't know how - chances are good that you don't need to do anything) and I would strongly suggest to password protect the directory 'zotero' (for example using .htaccess - again, google how or ask your hosting company) - otherwise your data will be accessible for everybody.

Now, the address to enter into your zotero sync preferences would be www.example.com/zotero/webdav_server.php (so that the full address would be www.example.com/zotero/webdav_server.php/zotero) and your data will be stored under www.example.com/zotero/data/zotero. For username and password enter whatever you set up for your directory in the previous step or enter anything if you decided not to protect the directory (I would seriously not do that, though).

DISCLAIMER: I do not accept any liability for any damage arising from the use of this script. You use this under your own risk. You are also solely responsible to ensure that your use of the script does not violate any copyright or other rules, for example, but not limited to, the TORs of any webhosting package you might decide to use with this script. The implementation is based on the sample implementation of the PEAR WebDAV server module by Hartmut Holzgraefe and uses said module as well as the PEAR base module, both licensed under PHP license. Versions of these modules are contained in the zip file.
DOWNLOAD: download phpZoteroWebDAV (148k)
[md5=0b75ad74968b7ece247e795237a7bdf0]

Good luck and share any experiences.
«13
  • Hi thanks for the description. Indeed many universities restrict Internet access severely so I really look forward to the final Version of Zotero 1.5. to use with WEBDAV.
    After following your great tutorial to install a webdav server on one's webspace using php I just have the problem that I get the message
    Warning: require_once(HTTP/WebDAV/Server/Filesystem.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/web176/html/zotero/webdav_server.php on line 6

    Fatal error: require_once() [function.require]: Failed opening required 'HTTP/WebDAV/Server/Filesystem.php' (include_path='.') in /var/www/web176/html/zotero/webdav_server.php on line 6

    Acknoledging that I have not so much of PHP experience, probably the problem is the include of the Pear packages?? But since many hoster don't allow to modify the php.ini, could you maybe also provide a version for this case which I think applies to many hosters. (Probably by using the init set command but I tried - without success).

    Anyway many thanks!

    cheers,
    johannes
  • edited March 17, 2009
    Hi Johannes,

    Sorry for not replying earlier - lots to do; I am sure you know how that feels.

    Your error messages suggest that the line in the script that sets the include path has not been executed. The command used only works for PHP versions 4.3.0 and above.

    To solve this, replace the line "set_include_path..." in your webdav_server.php with "ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $path_to_pear);"

    This should solve the problem, but it is possible that you use a php version even too old for that (and PATH_SEPARATOR not defined in your version), in that case just download the whole script again (I changed the code in a way that should work for all PHP versions) and replace your webdav_server.php with the new version. Note the disclaimer that comes with the script in the first post of this thread.

    Let me know if this did the trick.
    Christian

    P.S. You are right that the access to PEAR is the important bit. However, as I know the problem with PEAR and various hosters, I included all relevant PEAR packages in the inc directory of the phpZoteroWebDAV package. ini_set is the way to make php include those packages. I don't know what specific ini_set commands you run; the one included above should append "inc" to your include path, thus helping php to find the PEAR packages. As an alternative, you could just move everything from within the 'inc' directory into the same directory as your webdav_server.php file (maintaining the relative directory structure, though) - in that case the PEAR packages would be in a location your current include path ('.') points to.
  • Wow. This is awesome. Thanks, Christian!
  • Hi Christian,

    thank you very much for your reply. But it still doesn't work for me. Still get the same message (just now both errors refer to line 7).
    Moreover, the change of the init line is already incorporated in the new ZIP file right??
    And I am running PHP Version 5.2.6, so so far no clue what is the problem.
    But I am not quite sure about what you mean regarding the including of PEAR. Since I just have a web host provider, I cannot manipulate the php.ini myself and so the inlcude should do the trick but apparently it doesnt. Moreover, I am not quite sure if I move the inc Folders to "my" root directory (/html) that it would be included.

    Actually, i also tried it on a second webserver and got the same problem.
    Maybe if oyu had an idea what else try would be really appreciated - if your research lets you some time of course ;-)

    Merci,

    Johannes
  • edited March 17, 2009
    Alright Johannes,

    let's have another try. My guess is now that when you run the script, the working directory is not the directory where the script is based but some other directory (the document root, the directory where the php binaries are located...). Since both previous versions of the script used relative paths to point to the required PEAR modules, this would have to fail.

    Therefore, the script now changes into the 'inc' directory before initiating the webdav server instance. This should work now even without using include paths.

    Download the new version of the script and let me know how this works for you. Also, if it doesn't work, please try this alternative version (which still uses the "include_path" method but this time with absolute rather than relative path). In either case, please post any error messages you recieve. Also note the disclaimer that comes with either version of the script in the first post of this thread.

    Cheers,
    Christian


    P.S. what I meant with moving the PEAR modules was to move everything from inside the 'inc' directory one level up, ie to the same level as the webdav_server.php - however, this will not work anymore with the new version of the script.
  • Hi,

    There's also GAEDav (http://code.google.com/p/gaedav/) to let you setup WebDAV server on Google App Engine!
  • Thanks for sharing this link. Setting up WebDAV on google apps would be rather sweet. However, I find the website you linked to lacks any documentation. Do you have some more hints how to set this up or websites with instructions? Thanks.
  • Hi Christian,

    thanks!! works perfectly the NEW version, easily, so now can't wait for the beta to become official!! Great job!

    Cheers, Johannes
  • Thanks, Christian! The php webdav server turns out to be the perfect solution, now that mydisk.se has disabled webdav access for Zotero. Right now I'm happily syncing my 261 pdfs and snapshots onto my own server space, thanks to your self-contained little package. I only had one minor installation problem, and that was remembering to select http over https in my Zotero sync preferences (my SSL is now working for some reason on my web host). Thanks, again.
  • edited March 18, 2009
    Great. Just let me be boring for a second and provide a word of caution. If you use this little script with your web hosting package, refer to the TORs of your package. For a while, I was (albeit unsuccessfully) searching for a web hoster that did not explicitly disallow the use of their services for backup and other file storage purposes, so I could use it for zotero storage sync and similar purposes without breaching the TORs.

    Now, of course you could still do it and in my experience the worst thing that can happen is that they ask you to delete these files (or delete them themselves) threatening the termination of your account. For zotero sync that should not be too much of a problem, since the purpose is short term syncing and not long term safe storage and usually 'they' give you a couple of days to comply with their request.

    (since the TORs usually specify that your are not supposed to put files there that are not linked to a website, it might be a good solution to put an html/php page "up there" that contains a list of all items in your zotero library linking to the attachment in the file sync store. This would then create compliance with (at least the letter though probably not the spirit of) the TOR and would be a neat feature anyway. IF I find some spare time, I might put something like that together one day...)
  • edited May 2, 2009
    ermmm.... this is a bit embarrassing... but could someone who previously downloaded the phpZoteroWebDAV server please email me the zip file with the phpZoteroWebDAV package, as previously made available by me on my webserver? I had a server crash last week and a very very sloppy backup regime (blush) and now I don't have this anymore. Would suck to have to create it from scratch again.
    Email is -------
    This is very much appreciated!

    ----
    edit: ended up putting everything together again. the zip file is back to where it was. as before: share any comments or installation problems - I'll try to fix it.
  • i would love af copy to...

    cheers

    mads
  • Just to announce that after my server crash last week the phpZoteroWebDAV server is back and can be downloaded from the link in the first post of this thread.
  • thank you very much!

    i installed the script, but i get -15 error while verifying the server
    what does that mean?

    cheers, dmitry
  • As in the other thread: -15 is an unknown error & you'd have to look at debug output. It may be that your webhost doesn't like you uploading a lot of big files or throws some other error when you try to use the script.
  • dbogdanov,
    you should first make sure that your installation of the script works properly. To test, enter the URL of the script in your browser address bar, e.g. www.example.com/zotero/webdav_server.php
    If that doesn't throw any errors, the script is properly installed. In that case, I would still test www.example.com/zotero/webdav_server.php/zotero, just to make sure.
    Also, test your script installation with a WebDAV client (e.g. www.anyclient.com) - can you upload, download, delete, rename, overwrite files ok with that client and your installation?
    Let us know any error output (both from browser and webdav client) if any.
    Good luck!
  • Hi, I'm trying to set up a WebDAV server using my university webspace, but it doesn't appear to be working. I get this output when I enter "/***/zotero/webdav_server.php"

    <?
    chdir (dirname(__FILE__) . "/inc");

    require_once "HTTP/WebDAV/Server/Filesystem.php";
    $server = new HTTP_WebDAV_Server_Filesystem();

    $server->ServeRequest(dirname(__FILE__) . "/data");

    ?>

    The directories /inc and /data are definitely present. Any help would be much appreciated!
  • That is just the source code to the script. Perhaps you're not allowed to run php scripts on the server, or at least not from the directory you currently have the script in?
  • I think you are right, I'm probably not able to run php scripts. I'll have to e-mail someone and check that out. Thanks!
  • edited May 5, 2009
    Hi jollywollup,

    Thanks for posting this error. There was indeed a tiny coding error - the first line should read "<?php" instead of "<?". Some webservers (including mine - that's why this went unnoticed) are clever enough to figure out what is meant anyway, but others require correct coding (fair enough). So change this in your webdav_server.php (<a href="http://holz.ca/phpZoteroWebDAV.zip">or download the fixed version of the script) and check again. This could also be the solution for dbogdanov's problem.

    However, as noksagt pointed out, there might still be the problem that your university doesn't allow you to run php programs (which is, based on my own experience with university hosting, not unlikely). In that case you might want to ask the allmighty google to point you towards some free php enabled web hosting.

    Good luck,
    Christian
  • I found out for sure that php is not allowed on my university filestore, so I signed up for a free php hosting site. However, I am still getting errors when I try loading the webdav server. I can tell I'm getting closer, though. :-D

    This time, /zotero/webdav_server.php gives me:

    Warning: require_once(Console/Getopt.php) [function.require-once]: failed to open stream: No such file or directory in /***/zotero/inc/System.php on line 23

    Fatal error: require_once() [function.require]: Failed opening required 'Console/Getopt.php' (include_path='.:/usr/lib/php') in /***/zotero/inc/System.php on line 23

    Thanks again for any help on this.
  • edited May 8, 2009
    Hey Jollywollup,
    Yes. That makes sense. Again a case of my server setup being too robust to trigger this sort of issue. Bear with me a day or two until I have that fixed - I will do a bit more thorough testing this time (in fact - if you tell me what free service you signed up with - I could use that for testing)
    Sorry for the problems and thanks for letting me know the error messages.
    Christian
  • Hi,
    I have changed the zip package again, to take into include any fixed bugs that have been found by users. Thanks for sharing those error messages.
    Christian
  • Hey Christian,

    I installed the package to my webspace without difficulty. I know I can use php scripts (I use them for other content management packages), but when I try to put the correct URL into the box, it simply says "www.example.com"/zotero/webdav_server.php does not exist. I have verified, of course, that it has been uploaded, and I can access the index.html file within the directory. Any ideas? Thanks!
  • Hey... this is great!!! thanks a lot for this!!!
  • This is really awesome. Very easy setup. Works great with zotero.
    One question though:
    When I connect to webdav using gnome built in dav plugin the file names are displayed in caps and with the directory in them for example all files in /zotero/ directory look like "/ZOTERO/FILE.ZIP"
    Any idea why?
  • edited July 2, 2009
    ZIP/PROP files are normal & should be in all-caps:
    http://forums.zotero.org/discussion/6381/what-are-prop-or-zip-files-in-webdav/

    The 'zotero' directory name and the '.zip' extension should be lowercase on filesystems/operating systems that are case sensitive.
  • I obtained an S3 account only to discover that persons outside the U.S. apparently cannot sign up for the Amazon Payments system required to purchase Jungle Disk. I like S3 as a storage solution, but to sync Zotero I need a way to derive WebDAV URLs for the folders that I create on S3.

    So, one question for Christian: if I install your script on a PHP-enabled web server, can I configure it (reasonably easily) to use my S3 storage instead of the web server's storage?

    And a general question for anyone: do you know of a product or service OTHER than Jungle Disk that will create WebDAV URLs for folders on S3? (In other words, I want to continue using S3 as the actual file depot, but I need a way to get Zotero to access those files.)

    Thank you.
  • Toby: Are you sure? I have a Jungledisk account, payed for via Amazon payments, and I live in Australia. I'm not using S3, as the Rackspace option is cheaper (no bandwidth charges).

    You should have another look -- I've found the Jungledisk/Rackspace combination trouble-free and extremely cheap.
  • Hi CB. I wouldn't rule out Rackspace over S3, but Jungle Disk and Amazon Payments are my roadblock right now. On the "Sign Up for Amazon Payments" page, it requires me to identify a US state and zip code, without which I cannot proceed. Jungle Disk explicitly acknowledges this problem, but their solution does not work. (And in any case, to my knowledge I don't have a Mechanical Turk account.) I've read about others having the same problem. Do you remember how you got past it?
Sign In or Register to comment.