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.
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.
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
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.
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
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.
There's also GAEDav (http://code.google.com/p/gaedav/) to let you setup WebDAV server on Google App Engine!
thanks!! works perfectly the NEW version, easily, so now can't wait for the beta to become official!! Great job!
Cheers, Johannes
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...)
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.
cheers
mads
i installed the script, but i get -15 error while verifying the server
what does that mean?
cheers, dmitry
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!
<?
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!
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
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.
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
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
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!
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?
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.
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.
You should have another look -- I've found the Jungledisk/Rackspace combination trouble-free and extremely cheap.