1

i'm using php module xml_parser and i need to set the maximum memory allowed above the default one, or to do something to avoid crashing where the xml is larger than standard allowed. by the way i'm using http://www.bin-co.com/php/scripts/xml2array/ to parse the xml, but if it's larger than 13K it just crashes at line 16 that's xml_parse_into_struct($parser, trim($contents), $xml_values); it's not about setting memory_limit also, it crashes over and over, I've tryed setting it to more but i still get the same error, here is the error: Fatal error: Allowed memory size of 549453824 bytes exhausted (tried to allocate 24 bytes) in /www/file on line 16. Can you suggest another function please? (if you found another one better for my case)

2
  • 2
    have u tried switching to the XMLReader class? it doesn't load the entire xml document in memory, so u can work with really large files. Commented Nov 9, 2010 at 10:10
  • Numerous duplicates: stackoverflow.com/search?q=PHP+memory_limit Commented Nov 9, 2010 at 10:10

1 Answer 1

1

XMLReader, SimpleXML, and DOM are all much better alternatives to this ancient expat-based tool - however, only the first one is likely to help much with your REAL problem, which is that reading in your XML exceeds the memory_limit restriction you've set in your PHP configuration. Either move to a "pull parser" like XMLReader, or increase your memory limit.

Sign up to request clarification or add additional context in comments.

1 Comment

10x, i passed to simpleXML and increased memory_limit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.