Avaya Backup and Restore on IIS 7.5

IIS 7.5 does not support Anonymous webdav PUTS which is required by Avaya phones and to properly backup. However there is a solution.

This will only Work on IIS 7.5.

  1. Uninstall or Disable webdav on the website or virtual directory.
  2. Create a empty rewrite rule as follows
    1. Requested URL: Matches the Pattern
    2. Using: Wildcards
    3. Pattern: *.txt
    4. Action Type: Rewrite
    5. Rewrite URL: avayaupload.php
  3. Put the script below into avayaupload.php
{ $f = fopen(basename($_SERVER['REQUEST_URI']), "w");
  $s = fopen("php://input", "r");
  while($kb = fread($s, 1024))
  { fwrite($f, $kb, 1024); }
  Header("HTTP/1.1 201 Created"); }
elseif ($_SERVER['REQUEST_METHOD'] == "GET")
{ readfile(basename($_SERVER['REQUEST_URI'])); }


You are going to need PHP installed. The easiest way is to install it from here http://www.microsoft.com/web/downloads/platform.aspx

Make sure your BRURI is set and your BRAUTH is 0. A quick test is to use curl from a unix or mac machine. curl -T test.txt http://avayabackupserver/backupdir test.txt will be uploaded to the server if everything is configured correctly.



Please note that this was written for IIS 7.5 in 2008 r2 not for IIS 7.0 in 2008.

32 thoughts on “Avaya Backup and Restore on IIS 7.5”

  1. Thanks for that.Unfortunately in our case, we are still experiencing issues.

    We verified PHP is installed and working (any specific configs) and webdav is disabled?
    We verified IIS and Anonymous accounts have write access to all related directories and the file is in the backup directory as well as the rewrite rule is applied to the directory.

    We have used the following BRURIs :



    However we are still getting the following IIS errors.

    2010-09-01 19:35:29 IISHostIP GET /avaya/Location/userdata/avayaupload.php/8001_96xxdata.txt – 80 – AvayaIP
    AVAYA/SPICE/v3.0+(9630)/Std/0.1 500 0 0 1812
    2010-09-01 19:35:36 IISHostIP
    PUT /avaya/Location/userdata/avayaupload.php/8001_96xxdata.txt – 80 – AvayaIP AVAYA/SPICE/v3.0+(9630)/Std/0.1 405 0 0 0

    Any thoughts? Thanks in advance.

  2. Thanks. Sorry for the delayed response. I actually made a mistake in my last update . The BRURI was configured with and without the avayaupload.php in it and we get an HTTP error regardless. Can the backup location be a subdirectory in an IIS Virtual Directory or would it need to be it's own virtual directory? I believe we are 1 dotted i away from this working for us but cannot seem to pinpoint the source of the issue. Any thoughts are appreciated. Thanks.

  3. I can't get this to work. I keep getting this when trying to test via curl:

    HTTP verb used to access this page is not allowed.
    The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access

  4. I had to remove WebDAV completely in my environment to get this to work. Apparently Microsoft has some hooks for WebDAV even when it is disabled. After removing WebDAV, though, this solution worked like a charm!

  5. What features need to be installed in iis 7.5 to get this to work? I had to download php 5.2 and install manually as this server has no access to the internet. i chose fastcgi and it made me install cgi for iis 7

  6. Hi Stephen,
    I have tried to follow all your instructions but I am still facing a problem…
    Server Error
    405 – HTTP verb used to access this page is not allowed.
    The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
    I would appreciate if you can help me.
    Thanks in advance,

  7. Stephen,
    I have implemented your script on it own site with URL Rewrite set as you specify. When i test via curl the contents of the file i am sending REPLACE the avayaupload.php contents. After the first run there is no error but the file is no longer updated. Any ideas or more info I can provide for some assistence?

  8. Hi Stephen, my php53_error.log gives me this error:
    PHP Parse error: syntax error, unexpected T_IF in C:\inetpub\wwwroot\PhoneBackup\avayaupload.php on line 2

    Line 2 looks like this (based off of what I copied from your post above:
    2 if ($_SERVER[‘REQUEST_METHOD’] == “PUT”)

    Any ides why I might be getting this error. I don’t know PHP or troubleshooting its sytax.
    Thanks, Colleen

  9. Hello, we also having issues getting our avaya phone backups… I have set up the rewrite rule to point to the php script. However, when i test (using curl) I get a 405 error. Any ideas why? I have put the text.txt file and .php file in default web application.

  10. Got it working by reinstalling php… Now the Manual restore from back is not working just saying restore failed. Any reason why this would fail? Are there any other settings that need to be set?

  11. To fix the 405 HTTP Verb used to access this pages is not allowed problem —

    Under Handler Mappings for your site in IIS, edit the module mapping for PHP.

    Under Request Restrictions, in the verb tab add PUT to the existing verb list.

    (Note: You may need to add double quotations around the executable path before you can click ok)

  12. Hi Stephen,

    Great tutorial. I’ve the same issue with IIS7.0. I’d to modify your code because there is no variable named $_SERVER[‘REQUEST_URI’]. So I inserted this before:

    if (!isset($_SERVER['REQUEST_URI'])) {
    $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],0 );
    if (isset($_SERVER['QUERY_STRING']) AND $_SERVER['QUERY_STRING'] != "") {

    Your script works after that but the content of the php file itself is replaced everytime a backup is made. Do you have any idea how to change this?


  13. This didn’t work for me. I’m getting the same 405 error as above. Roel’s script also doesn’t work for me either.

  14. I’m not sure how you ever got this script working as there is one major issue with it. If you use $_SERVER[‘REQUEST_URI”] you will always be pulling the avayaupload.php. REQUEST_URI pulls the script that is running, and since you are forwarding to avayaupload.php that is the script that is running.
    To fix this issue you need to change it to $_SERVER[‘HTTP_X_ORIGINAL_URL’] and it will pull the URL that was forwarded to avayaupload.php
    Took me a little while to realize what the problem was, I ended up doing a var_dump($_SERVER) to find what was happening.

    At this point I have the GET working perfectly, but I am still unable to do the PUT. I receive a 200 0 0 4227 error in the logs. I will continue to troubleshoot, and if I find the solution I will post it.

    Thanks for the tips on this.

  15. The problem that I was having was a permissions issue. I resolved it by setting up a specific user for the web application to use for anonymous access. Here is the code that I settled on using. Pretty much identical to what was originally posted minus the HTTP_X_ORIGINAL_URL and one extra unset.

  16. I don’t often comment on posts but this really was helpful in resolving my issue. We needed to decommission an old 2003 box and replace with 2008 r2 which wasn’t working with the Avaya phones backup.

    My only issue was with the actual PHP install which I followed from a different site.


    The script and the rule worked provided here worked perfectly.

    Thanks for the post.

  17. Sorry to comment on this 3 years after the fact but, as my first major task at a brand new job, I have been asked to get the backups working for the Avaya system without using Apache or MyIPtel and without having authentication prompts. This site and Roel’s (ASP solution) have been really helpful in getting most of the way

    Prior to attempting the PHP or ASP workarounds, the Backup would straight fail. Now, it states “Backup Successful”, but there is not actually any txt file created, despite the logs showing as such:

    2016-08-16 19:29:12 PUT /avaya_phone_backups/6617_96xxdata.txt – 80 – AVAYA/SPICE/v3.2+(9640)/Std/0.1 200 0 0 11

    Now, I know 200 is supposed to indicate success (according to HTTP codes) but, if I read your script correctly, it should be logging it as 201 if it is actually successful.

    I have tried literally everything I can think of.
    -Created PHP file on the server with the exact script in this blog
    -URL rewrite set up as specified and pointing to PHP file
    -tested PHP to make sure it is working – it is
    -handlers all have PUT added
    – Edited 46xxsettings.txt and made sure BRURI points to the directory I want the backup txt files in (have tried both with and without a slash at the end of the path) and that BRAUTH is = 0
    -Made a dedicated account for this purpose, and added it to the Anonymous Authentication settings in IIS
    -Made sure said account has Write permissions on the folder I wish the backup txt files to go in.

    I’m completely stumped. Great way to start a new job, failing at the first major task put in front of me.

    Any assistance you can provide would be greatly appreciated

    1. I have not looked at this in a long time. I would recommending testing with curl -t to get a better idea if the uploads are working.

      Ill send you an email for some more info.

  18. I sent some follow-up e-mails. I had not been using curl at first, and then once I did, I wasn’t using it correctly. Here’s the latest once I got things figured out:

    Turns out that it was the HTTP 405 error. However, the PUT handlers all seem to be in place

    Just in case, I added a Handler to the site which was a ProtocolSupportModule using a * as the path and Restricted Verbs to allow PUT. I used an existing handler for OPTIONS as my template and copied it exactly, substituting PUT for OPTIONS

    Funny thing was, after I did this, curl now seems to work, as when I execute the command, it takes me right to another prompt. The logs show that the curl executed and had an HTTP code of 200 (again)

    But, there is no text file in my backup directory (again). Which takes me back to square 1.

    I’m thinking it isn’t actually possible for whatever reason.

  19. I finally got it!

    Hopefully this helps out anyone who visits here, and doesn’t know curl or php (like me).

    If you follow ALL of the steps above, but still get the HTTP 405 issue with curl -T, it may not actually be an issue with the PUT command, even though that’s what curl says. curl needs to have a filename to send the test.txt file to, as well as an existing test.txt file. so make sure you are in the folder containing the test.txt file before you execute the command, and then after the url, add test.txt so it has a file to place.

    So if your path to your backups is ServerIP/backup, you would want to use this command:
    curl -T test.txt http://ServerIP/backup/test.txt
    Then curl should execute with no errors and you will see the test file in your backup directory. If that happens, your phones will now backup properly

    My underlying issue was that the URL rewrite needs to a) Apply to just the backup folder [not at the Site level – though that might work, I’m just saying what finally got it going for me] and b) Not only point to the path containing the php script, but to the php script itself [ ie. if your path to your backup folder is serverIPAddress/backup, the Rewrite URL needs to be /backup/scriptname.php ] .

    Also, the script above has < at the beginning and > at the end, if you replace those with a respectively, it might help too.

    After many days and many struggles, it is now working. Big thanks to the OP for this fix and helping me get it working.

  20. I’m having a similar problem to Brett with the .asp script, shows up as 200 OK but doesn’t actually write any files. I’ll try the .php script tomorrow. But did anyone find any reason for this behavior? It’s quite strange.

  21. Before you set IIS, how do you configure phone backups on Avaya’s side. We have a DHCP option for phones that points to a webdav server that has been decommissioned, so I need to setup a new server but I don’t know where to start.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.