Jump to content

Recommended Posts

Hi all,

 

I have been trying to parse a 250MB xml file using PHP5's XMLReader.

 

This is working perfectly for small files but stops mid process (without any error messages) after about 10 seconds when processing test xml files around 16MB.

 

Has anyone got any suggestions??

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/51849-problem-parsing-large-xml-file/
Share on other sites

You are most likely exceeding php's assigned memory limit. 

 

You have a couple of choices...increase the memory limit in php.ini, which isn't recommended...especially not for a 250 MB file cause each time your script is called it would load all 250mb into memory...imagine having 1000 concurrent visitors, each using 250 MB of memory.

 

The other choice would be to split the file up.  You may be able to use fread to read the file in and process it in smaller pieces, but I'm not sure since it's XML, which may be finicky.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.