Thanks for sheding a lot of light on this.

As for error handling in the REST code I found that the PUT data must be read or the script will wait until timeout. Adding something like the following will make sure that any error immediately handles the input stream:

[code]
set_error_handler(function() {
@fclose(@fopen(‘php://input’, ‘rb’));
exit;
}, 0xFFFF);
[/code]

Of course the error handler would need to be be a bit more sophisticated in a real world application, but I hope you all get the picture.