Script runs on shared hosting and obeys the root php.ini file. It uses PHP 5.4 so there's no safe_mode and it's not using .htaccess files. I asked support if they have any limits, she said the timeout is two hours on their side. On localhost it doesn't stop but ignores my limits.
This example stops after 601-606sec (~10min) instead of 1000sec:
// For immidiately printing in browser
header('Content-Type:text/html; charset=UTF-8');
$limit = 1000;
set_time_limit($limit);
ini_set('max_execution_time', $limit);
ini_set('max_input_time', $limit);
ini_set('memory_limit', $limit . 'M');
ini_set('max_input_time', $limit);
ini_set('post_max_size', $limit);
ini_set('file_uploads', $limit);
ini_set('upload_max_filesize', $limit);
$start = microtime(1);
// Every second prints elapsed seconds
for ($i=0; $i<1000; $i++){
echo str_pad(round(microtime(1)-$start), 4096);
flush();
sleep(1);
}
- Most important question is why it stops? I don't need 2 hours but 20-30min will be nice.
- Why it ignores my limits? I can change $limit to '1' but it will change nothing.