I'm trying to convert from Apache to Nginx, and it's not going too bad. However, there is a problem that I've encountered with our API, which outputs quite a lot of stuff and can take up to 1 second when regenerating the cache. It seems to work ok from time to time, but most of the time the output is truncated to 24296 characters, consistently.
I've tried this script:
<?php
$str = '';
while(strlen($str)<524297){
$str .= strlen($str).'<br />';
}
echo $str;
which outputs the following:
0<br />7<br />14<br />22<br />30<br /> [...etc...] />102284<br />102296<br />1023
A total of 102313 characters, every time. This indicates it could be a memory issue, so I did this instead:
$str = '';
while(strlen($str)<524297){
$str .= memory_get_usage().'<br />';
}
echo $str;
Which gets up to
772616
7726
.. even though php.ini says memory_limit=512M
I wonder if it's a time limit, so I do this instead:
$start = microtime(true);
while(strlen($str)<524297){
$str .= (microtime(true)-$start).'<br />';
}
echo $str;
0.0083520412445068
0.0083539485931396
0.008357048034668
( total of 89793 characters)
The thing I really don't understand, is why, if the string length has not exceeded 524297 characters, does it quit looping and start printing?
Pretty confident that solving this is the only thing holding us back from testing.
Thanks!