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);
}
First about timeouts:
set_time_limit() and max_execution_time don't count sleep(), system(), file_get_contents() and DB calls. That's why I thought the script ignores my limits.
I talked again to support and turned out that what stops the script is not Apache timeout but «something» that monitors scripts and stops it after 10 minutes for shared IP customers. I asked him for full list of limits:
Type | Dedicated | Shared -----------+-----------+----------- Apache/Web | 12 hours | 10 minutes SSH/Shell | 2 hours | 1 hour Cron Jobs | 1 hour | 30 minutes Daemons | Unlimited | 10 minutes
That's why it ran fine from the cron.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With