I try to proceed a large xml file (about 1.5 GB) with about 3 million items with PHP XMLReader. But the script stops randomly between 2,3 and 2,6 million items without an error.
There is no time or memory limit.
set_time_limit(0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
error_reporting(E_ALL);
This is the code:
$Reader = new XMLReader();
$Reader->open('file.xml', NULL, LIBXML_PARSEHUGE);
$count = 0;
while ($Reader->read()) {
if ($Reader->nodeType == XMLReader::ELEMENT && $Reader->name == 'file') {
$outerXml = $Reader->readOuterXml();
$count ++;
echo $count . "
";
}
}
echo 'end';
XMLReader seems to have some kind of restriction. I already tried the LIBXML_PARSEHUGE option but with no success.
Anyone has an idea?
Thanks!
UPDATE: It seems to be a problem with http curl via SSH, even with --max-time option set. It works with when running directly through the PHP parser.