In a php file I am reading the input stream which contains an image.
$incomingData = file_get_contents('php://input');
$fh = fopen($uploadPath, 'w');
fwrite($fh, $incomingData);
fclose($fh);
For small images this works just fine, for bigger ones which takes longer than 15 seconds or so i get a 502 bad gateway response.
The apache error log is saying:
child pid 1492 exit signal Segmentation fault (11)
I tried this but that did not work.
ini_set('default_socket_timeout', 120);
But I am not sure of its a time out.
edit// CODE:
$uploadFilename = time();
$uploadPath = '/path/melvin.jpg';
$fhSrc = fopen('php://input', 'r');
// Valid data?
if($fhSrc) {
$fhDst = fopen($uploadPath, 'w');
while (($data = fread($fhSrc, 1024)) !== FALSE) {
fwrite($fhDst, $data);
}
fclose($fhSrc);
fclose($fhDst);
}
echo 'ok';
RAW HEADERS:
POST /test.php HTTP/1.1
Host: hi.com
User-Agent: secret/1.0 (unknown, iPhone OS 5.0.1, iPhone, Scale/2.000000)
Accept: */*
Accept-Language: nl, en, fr, de, ja, it, es, pt, pt-PT, da, fi, nb, sv, ko, zh-Hans, zh-Hant, ru, pl, tr, uk, ar, hr, cs, el, he, ro, sk, th, id, ms, en-GB, ca, hu, vi, en-us;q=0.8
Accept-Encoding: gzip
Settings: {SOMEJSON}
Content-Type: application/x-www-form-urlencoded
Cookie: CAKEPHP=2b82f748fb3a64063b2e3be9bdec5c11
Connection: keep-alive
Transfer-Encoding: Chunked
Pragma: no-cache
Cache-Control: no-cache
and here in the boy the Big image