Apache – How to Enable PUT Method for Any PHP Script

apache-2.2debianhttpPHP

I would like to enable the PUT and DELETE methods to any .php script on my Apache web server.

Currently I only have this answer :

The requested method PUT is not
allowed for the URL /something.php

I'm running Apache2 / PHP5 on a Debian lenny.

Best Answer

Thanks, @Abhi for pointing to my blog post on the subject. If it weren't for referrer logs I wouldn't have been aware of this page. It seems that I am not the only one who has run into this question.

The short answer:

You need to enable mod_actions and mod_rewrite in Apache, add a <Limit> and <LimitExcept> block to your <Directory> block, and set up a RewriteCond %{REQUEST_METHOD} (PUT|DELETE) and a RewriteRule .* something.php.

For the long answer see my post at http://www.evardsson.com/blog/2010/04/27/apache-and-php-http-put-voodoo/