How to enable and use HTTP PUT and DELETE with Apache2 and PHP?

Posted by Andreas Jansson on Stack Overflow See other posts from Stack Overflow or by Andreas Jansson
Published on 2010-05-29T09:50:58Z Indexed on 2010/05/29 9:52 UTC
Read the original article Hit count: 442

Filed under:
|
|

Hi,

It should be so simple. I've followed every tutorial and forum I could find, yet I can't get it to work. I simply want to build a RESTful API in PHP on Apache2.

In my VirtualHost directive I say:

<Directory />
    AllowOverride All
    <Limit GET HEAD POST PUT DELETE OPTIONS>
        Order Allow,Deny
        Allow from all
    </Limit>
</Directory>

Yet every PUT request I make to the server, I get 405 method not supported.

Someone advocated using the Script directive, but since I use mod_php, as opposed to CGI, I don't see why that would work.

People mention using WebDAV, but to me that seems like overkill. After all, I don't need DAV locking, a DAV filesystem, etc. All I want to do is pass the request on to a PHP script and handle everything myself. I only want to enable PUT and DELETE for the clean semantics.

Thanks,

Andreas

© Stack Overflow or respective owner

Related posts about php

Related posts about apache