PUT/DELETE data is lost after 5 requests
I'm simply trying to do PUT/DELETE requests in my PHP application, but after the first 5 requests, the data is lost.
I've reduced the code to this to illustrate the issue:
index.php
$h = fopen('php://input', 'r');
var_dump(fread($h, 1024));
die();
CLI input
curl -X PUT http://cms.dev.com -d '{"foo":"bar"}'
So, for the first 5 times I run that, I get:
string(13) "{"foo":"bar"}"
Then, from the 6th onwards, I get:
string(0) ""
I'm running PHP Version 5.6.0beta1 and Apache/2.2.26, installed on OSX 10.9.3 via Mac Ports.
POST works fine.
EDIT It might be worth noting this can be replicated on 2 other colleague's MacPorts setups, but can't on MAMP, which seems to act correctly.
Does anyone have ideas? It's driving me crazy!
Thanks, Todd
I cannot reproduce this using the built-in webserver, which might indicate an interaction between apache and php.
Try running :-
php -S localhost:8001
in one terminal and
for n in `seq 1 100`; do curl -X PUT http://localhost:8001 -d '{"foo":"bar"}'; done
in another - see if it's limited to php or at the mod_php level.
My testing is on a linux box with 5.4.9 fwiw.
Upgrading to php 5.6beta3 fixed the issue.
Must have been a bug in php 5.6beta1!
Hopefully this'll help someone else :)
链接地址: http://www.djcxy.com/p/41048.html上一篇: 它们是否依赖于实现?