I have this strange problem when i run an import cronjob in made. It processes a 1.5GB XML file containing about 400.000 products. The script works fine and would take multiple hours to complete, but after about 500/600 seconds i get the following email from the cron-deamon.
PHP Warning: file_get_contents(http://test.nl/admin/cron_index.php?route=module/EZImport&cron): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /home/test.nl/public_html/admin/controller/tool/EZImport_cron.php on line 8
Warning: file_get_contents(http://test.nl/admin/cron_index.php?route=module/EZImport&cron): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /home/test.nl/public_html/admin/controller/tool/EZImport_cron.php on line 8 bool(false)
My apache error-logs say:
[Fri Nov 02 09:43:39 2012] [warn] [client 176.9..174] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server [Fri Nov 02 09:43:39 2012] [error] [client 176.9..174] Premature end of script headers: cron_index.php
This is the cron file called by the cronjob
require_once('../../config.php'); $opts = array('http' => array('timeout' => 36000) ); $context = stream_context_create($opts); $url = HTTP_SERVER."cron_index.php?route=module/cronMod&cron"; $result = file_get_contents($url, false, $context); var_dump($result); die();
I need to run this cron via file_get_contents
Environment:
DEBIAN, OpenCart
The max execution time in webmin (php config) is set to 36000 seconds.
file_get_contents
method, you really should consider switching your cron job to use the CLI version of PHP which does not suffer from the time limits the other SAPI's impose. – Rem.co