I have this PHP code:
test-2.php
ini_set('max_execution_time', '900');
ini_set('memory_limit', '2048M');
$start = microtime(true);
$mh = curl_multi_init();
$handles = array();
// create several requests
for ($i = 0; $i < 50; $i++) {
$ch = curl_init();
$rand = rand(5,25); // just making up data to pass to script
curl_setopt($ch, CURLOPT_URL, "http://example.com/test-3.php?time=$rand");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_multi_add_handle($mh, $ch);
$handles[] = $ch;
}
// execute requests and poll periodically until all have completed
$isRunning = null;
do {
curl_multi_exec($mh, $isRunning);
} while ($isRunning > 0);
// fetch output of each request
$outputs = array();
for ($i = 0; $i < count($handles); $i++) {
$outputs[$i] = trim(curl_multi_getcontent($handles[$i]));
curl_multi_remove_handle($mh, $handles[$i]);
}
curl_multi_close($mh);
print_r('<pre>');
print_r($outputs);
print_r('</pre>');
printf("Elapsed time: %.2f seconds\n", microtime(true) - $start);
And test-3.php
sleep(5);
echo time();
Each time when i access test-2.php is receiving only max 10 outputs via URL ( apache )
Array
(
[0] => 1599904635
[1] => 1599904635
[2] => 1599904635
[3] => 1599904635
[4] => 1599904635
[5] => 1599904635
[6] => 1599904635
[7] => 1599904635
[8] => 1599904635
[9] => 1599904635
[10] =>
[11] =>
[12] =>
[13] =>
[14] =>
[15] =>
[16] =>
[17] =>
[18] =>
[19] =>
[20] =>
[21] =>
[22] =>
[23] =>
[24] =>
[25] =>
[26] =>
[27] =>
[28] =>
[29] =>
[30] =>
[31] =>
[32] =>
[33] =>
[34] =>
[35] =>
[36] =>
[37] =>
[38] =>
[39] =>
[40] =>
[41] =>
[42] =>
[43] =>
[44] =>
[45] =>
[46] =>
[47] =>
[48] =>
[49] =>
)
Elapsed time: 5.02 seconds
but if i run the code from test-4.php
exec('php /test-2.php',$output);
print_r($output);
Is showing all 50 ... but each time when i try to run via URL is max 10 ... is any way i can increase the limit ?