"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > * Thus wrote Seairth Jacobs ([EMAIL PROTECTED]): > > Under Apache 1.3, how can I respond to DELETE request with a PHP script? I > > have no problem with GET, POST, or PUT. The only thing I found was the > > "Scripts" directive, but that requires a specic script to be named. I am > > looking for something more generic, possibly where I can just say that php > > scripts can accept DELETE requests. > > hmm.. I've never seen the DELETE method used anywhere, and probably > for good reason. By default you cant use this method with apache > and I'm not sure if you can enable it without recompiling it or > getting a patch that enables it.
Yes, Mod_Actions allows this functionality, but this ability is a "blanket statement"-style directive, where *all* DELETE requests would go to the same single script, regardless of what the DELETE was for. > Now if you do enable the method, it is rather undefined on how it > would be handled by php. According to some documentation I found > (w3c) is: > > <quote> > DELETE > Requests that the server delete the information corresponding to > the given URL. After a successfull DELETE method, the URL becomes > invalid for any future methods. > </quote> > > If the client issues a 'DELETE /file.php' will the server delete > the php file and make it unusable. Or will it pass the Request to > php. If the latter happens then my assumption is that it will be like > a GET request but the $REQUEST_METHOD variable will be 'DELETE' > instead of 'GET'. And you program can act accordingly. Well, the argument could be made for PUT as well. Should the server PUT a new copy of the PHP file, or pass the PUT on to the PHP file for processing? Currently, the default behaviour is to pass the request on to the script, which is what I would expect and what I want for DELETE as well. My application has a single entry-point script with its own maintained sub-paths. Such a DELETE request would inform that script to delete the names subpath (or return the appropriate HTTP response... likely 405). > Now with that said, the common way to simulate a DELETE method is > by using GET with query paramaters telling you that this request want > to really delete something. In general, this is not a good design. GETs are not supposed to cause side-effects. Use of POST to a given URI's container URI would be a better alternative. Still, it's a shame that all the HTTP verbs are not better supported, as more applications are beginning to use them (finally). It's just that most people think the only HTTP client is the Web browser, which is not true anymore. Thanks for the reply. --- Seairth Jacobs [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php