phpZoteroWebDAV 2.0 - php based WebDAV server and library and attachment viewer

  • Thanks! This solved that part of the problem and now I am able to verify the server.

    When I try to sync now however I get the following error message:
    Unexpected status code 509 in Zotero.Sync.Storage.WebDAV_getStorageModificationTime()

    Any ideas?
  • Wilko,
    there is no way to be certain, but this sounds like an HTTP error from your server; 509 is "Bandwith exceeded" - maybe your PHP server doesn't like the type of traffic zotero is creating (from your previous problem it appears that your php server has been compiled with unusually restrictive options).
    I am not sure how I can help you any further without having access to your server for trouble shooting. Hope you can figure something out.
  • hi Krueschan,

    I have this problem:
    "AN ERROR HAS OCCURRED! - Unable to proccess zipfile """

    can you help me?

  • I followed you instructions, but when I try to verify the server at it keeps giving me a message that it isn't a valid WEBDAV URL. Any ideas?
  • awesome! I set up my personal server on opensuse and find it works very well.

    But as I have to work on different computers and have almost 500 items in my library, is it possible to show them through tags or collections? And to sync the notes? So I won't need to install zotero and sync the library everywhere.

    Thanks! I love this stuff!
  • I'm having the same issue as stocksohio
    I cannot verify the server and get the "is not a valid WebDAV URL" error. I tried the override using about:config settings as mentioned elsewhere, but still have no luck syncing the library. Any ideas?
  • Hi, I have the php script setup and it seems to be working nicely.

    Only one thing I found is that there are 2 types of pdf attachments, file links and file copies. It seems that the linked files are not synced to the server (which makes sense since you have the link), only the file copies are. For the file copies I do get the "attachment on webdav server" URL. However, I'd like to be able to also access linked pdfs from webdav. Is it possible to get Zotero to sync linked files to webdav so I can access them through the script?

    Another option would be to store the pdfs as copies, not linked files. I mostly use translators to get pdfs from scientific journals directly from the browser. By default the pdfs are then saved as linked files, is it possible get pdfs through browser translators and store them as file copies?
  • edited May 22, 2012
    I don't know much about krueschan's PHP script, but on the Zotero side:
    1. no, Zotero doesn't sync linked files ever - not via webDAV and not via it's own Zotero storage and it can't be done.

    2. By default, Zotero translators save copies, not links. In fact, it's impossible to get Zotero translators to save links to files, so I'm not quite sure what you're seeing.
  • thanks, what I mean under 2. is the following...
    When adding an item through translator I get a pdf file which has a link displayed below the title in the pane on the right. These files do not get synced so I dont get an access through webdav link. When I manually add a pdf attachment to an item it wont have a link, and these files (file copies) do get synced.

    I think this is the link mode 0 and link mode 1 difference in files when you look at attachments through the php script web interface. So what I would need is to have the translators save the pdf as a link mode 0 or copy.
  • But when you click "show file" the file is in a subfolder of zotero/storage - the Zotero storage folder - correct?
    Those files get synced by Zotero and no, they're not actually different from files that you just drag to Zotero, I don't know if/why the php script would treat them differently.
  • Yes, those files do show up in local file storage. It seems then that it is the script that is the problem, i found on github that this got fixed:

    however, i've checked the code on the server and I have this same version..
  • i got the same problem with widianta.gomulya.
    It happened only to some of my library items. i took a look, found out the attachments (pdf file copy) are not synced to webdav_server, however, if i add the item again, it can be synced and everything works fine. this instability makes this system very hard to maintain.
    if memory severs, click the sync button did not make the attachments sync to webdav_server(the bad items).
  • edited July 2, 2012
    awsome app! thanks.
    One minor issue: i use your script on an apache server on windows (a xampp installation). i figured out that $data_dir works only as relative path for me, not as absolute path.
    if i try absolute path, i get
    found oneAN ERROR HAS OCCURRED! - Unable to proccess zipfile ""
    when trying to open an attachment (also, i dont make use of your php webdav implementation - i use my own apache webdav)
  • edited July 6, 2012
    hi, i took the liberty and cleaned up some minor bugs in the interface, solve some link mode problems (opening attachments / websites with online links directly from webdav is now optionally possible), and implemented a title/author text search (my mod will return the first 50 matches of your text search - that should be enough to find a paper easily). also, i took care of some path issues for my apache on windows, i hope this doesnt affect linux users (my problems came from the implementation of php's realpath).
    here is a link for download:

    p.s. i didnt make any changes on the php-webdav implementation
  • I don't know how krueschan prefers to handle this, but I assume it would makes sense if you would issue a pull request to his github version of this.
  • yes, i will upload my changes and send a request.
  • Hi,

    I'm frustratingly close to getting this to work I hope!

    I can verify the server but when I start to sync it hangs and the icon spins forever.

    Here's the end of the debug output (prior to this it has zipped the 2 files for upload and begins HTTP PUT for them):

    (3)(+0000000): Invalid progress for request 'null/4CNHC98A' (3342336 < 3407872)

    (3)(+0000000): Invalid progress for request 'null/4CNHC98A' (3375104 < 3407872)

    (3)(+0019317): onStartRequest

    (3)(+0000000): onStopRequest

    (3)(+0000920): onStartRequest

    (3)(+0000000): onStopRequest

    It commences uploading the 2 zip files and fails on complete of upload, I have checked on my server and the 2 files are there but the zip files are corrupt (I have downloaded the files and tried to unzip).

    My folder permissions on the server are 755 for data and cache I have also increased my php upload limit above the default.

    Aside from output in the debug panel I'm getting the following in the error report, but not sure if it is related:

    [JavaScript Error: "[Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIHttpChannel.responseStatus]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: chrome://zotero/content/xpcom/storage.js :: <TOP_LEVEL> :: line 2598" data: no]" {file: "chrome://zotero/content/xpcom/storage.js" line: 2598}]

    Any thoughts?
  • edited July 28, 2012
    I did some testing of this script on a ubuntu server with php 5.3.2-1ubuntu4.15. I made sure I followed everything in the install and configuration settings strictly, especially the sync settings are set like this:
    Everything looks to work fine. The only thing which does not work, is showing content on these php scripts in my browser:
    They are just completely blank screen, also if I make the whole zotero directory and its childs word writable. There are no errors in apache error log. Showed html-code of the index.php is
    <<start code>>
    <link rel="stylesheet" href="inc/css.css" type="text/css" media="screen" charset="utf-8"/>
    <style type="text/css">
    a { text-decoration:none }
    <<end code>>
    I am sure syncing of attachments is going okay, because I can find the synced attachments back in one of the zip-files in 'data'.

    These urls are showing up well in my browser

    It would be nice if I could check my refs in every browser in stead of installing zotero on every browser I hop along. But if this does not work, I don't see any advantage of using this script over connecting to a decent normal webdav server.

    Thanks for you effort anyway.

    PS: I did some wild testing and found out that curl is not activated in php at my hosting. The script 'inc/phpZotero.php' now hangs at this part of the script:
    <<start code>>
    if (function_exists('curl_init')) {
    $this->_ch = curl_init();
    } else {
    throw new Exception("You need cURL");
    <<end code>>
    Anybody knows an alternative code? url_fopen is enabled in my hosting.
  • Hello again,

    I changed hosting and now curl is working and I get output in zotero/index.php, zotero/attachments.php, etc.

    I did a lot of testing in the syncing between my zotero client and my new webdav server today. Things I found out are:
    1. If I damage some data in webdav under data/zotero, syncing is not taking care of repairing it.
    2. If I remove all data in webdav under data/zotero and cache mostly syncing is working and data from my client is synced to webdav, also the attachments. At least one time it did not work and I could only get a good sync from client to webdav by completely remove the scripts on webdav and start allover.
    3. If I start a fresh browser profile (firefox in my case) syncing is apparently working most of the time, but often a red arrow next to the syncing arrow shows something is not right. All items from webdav after the sync show up in the client, including the names of the attach, but if I want to view the attach I get a response that they can't be find and if I want to locate them manually.

    I also tested with a real webdav server, and the syncing was working flawlessly here. So for the moment my conclusion is that your script is not stable enough for me to use for my production work and I first start to use syncing with my regular webdav server provider. But I will keep an eye on the progress and wil eventually do some more testing again.

    Thanks very much,
  • I'm trying to setup phpZoteroWebDAV.
    But fail during verify server.

    If under data there is no directory called "zotero" then verify server asks if it should create no. It then returns with failure "-14".

    If under data I manually create the directory called "zotero", then verify server runs indefinitely .

    Any ideas?
  • Hi, may be no one is looking at this anymore, but I'm trying to get my server running and it doesn't work.

    If I look on the browser for the files:
    /zotero/webdav_server.php -> index of files
    /zotero/index.php -> index zotero metadata (very nice!)

    But the syncing is not working. If I run the verify sever and there is no zotero folder on data it creates one which doesn't allow me to write on it (I don't know how to change the permissions)
    If I manually create the folder it does allow me to write on it.

    On both cases it does not verify the sever and throws an unknown error.

    If I add a nonexistent.prop file in there it says that non existent file is reported to exist.

    I don't know how to troubleshoot from here
  • Hi krueschan,

    thanks for your great software. I run your server for a research group within a government department, and our legal boffins would sleep easier if we could host our files ourselves.

    It is very useful to sync individual libraries with your server. What would be involved for your server to support subcategories and group libraries?

    Cheers from down under and thanks for your great work!
  • Hi guys,

    first off, many thanks for the great scripts!

    The problem: I was having the issue of the empty attachment field when viewing an item of my library on the browser-based viewer (Firefox 26.0 on Win7) though everything was fine on the API side.

    The solution: I found that hitting refresh fills the attachment field with all the info and links. (Maybe a timing issue ?)
  • edited October 5, 2017
    Hi Everyone,

    I am having the same server verification problems others have mentioned getting the "is not a valid WebDAV URL" error. I don't have any files synced yet, but I can access the site using a browser without any errors. Any ideas?

    Debug ID is D416227251

  • Zotero 5.0.60 on Fedora 29.

    Trying to set up sync to phpZoteroWebDAV 2.0 - is this software still working with later PHP versions?

    Host is running PHP Version 7.2.14, on Apache. Directory is .htpasswd protected.
    WebDAV through browser works as expected, asks for and accepts credentials.

    Clicking on "Verify" in sync gets a little green bar that ends quickly, no confirmation.

    Forcing sync generates error:

    Error is (several times):
    [JavaScript Error: "err is undefined" {file: "chrome://zotero/content/xpcom/storage/webdav.js" line: 745}]

    version => 5.0.60, platform => Linux x86_64, oscpu => Linux x86_64, locale => en-US, appName => Zotero, appVersion => 5.0.60, extensions => Zotero LibreOffice Integration (5.0.14.SA.5.0.60, extension)

    Debug error is:

    ReportID is:

    From the debug output, during sync Zotero auths okay but then gets hung up on:
    (Debug ID D788088064)

    (3)(+0000004): <?xml version="1.0" encoding="utf-8"?> /zotero/webdav_server.php/ HTTP/1.1 200 OK HTTP/1.1 404 Not Found

    (3)(+0000002): HTTP GET https://zotero:********@XXXX.YYY/zotero/webdav_server.php/zotero/nonexistent.prop

    (3)(+0000004): {}

    (1)(+0000098): HTTP GET https://zotero:********@XXXX.YYY/zotero/webdav_server.php/zotero/nonexistent.prop failed with status code 200

    If I create a dummy nonexistent.prop file, writable, the sync still fails:
    (1)(+0000098): HTTP GET https://zotero:********@XXXX.YYY/zotero/webdav_server.php/zotero/nonexistent.prop failed with status code 200

    with console output:
    TypeError: err is undefined
    From previous event:
    Possibly unhandled rejection:

    Thanks for any help.
  • Have been using for many years with no problems. Recently standalone Zotero on my MacBook Pro (macOS 10.14.6, Zotero 5.0.75) fails to sync attachments with this error:

    JavaScript Error: "Your WebDAV server returned an HTTP 406 error for a PUT request.

    If you receive this message repeatedly, check your WebDAV server settings or contact your WebDAV server administrator.

    IHave run into no problems on the Windows 7 machines i use at work that are using also running standalone Zotero.
  • edited October 8, 2019
    @rpallred: You need to contact the server administrator, as the message says. The server is returning a 406 Not Acceptable error, which is a rarely used error, and one that makes particularly little sense here.
Sign In or Register to comment.