You are here:  » Error mesage

Error mesage

Submitted by rubenxela on Mon, 2010-03-29 17:37 in

Since I know magicparser and this forum, I work for a website that I pushed online today. But I reeived a message from my host because scripts eat to much CPU !!!!
So I tried to host the script with another dedicated server that I go but I've a mesage error when I try to do some kind of search

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 50 bytes) in /home/xxxxxxx/www/MagicParser.php on line 2

Do you know what I can do ?

Submitted by support on Mon, 2010-03-29 17:48


That could be caused by 3 things;

1) The XML that you are parsing does contain very large records (where each record can be greater than the memory limit being set by your server)

2) Parsing an XML file at the top level (e.g. using a Format String such as xml|RESULTS/) and the response XML is greater than the PHP memory limit set by your server

3) (least likely) Parsing a CSV or XML source; and an error in the output has resulted in large amounts of corrupt but still valid within the rules of the format that exceeds in length the memory limit of your script. For example, if a CSV file for some reason did not have new-line characters in place.

All ultimately mean the same thing - the parser has not encountered an end of record marker before exceeding the memory limit available to your script.

If you're not sure, presumably your search script is taking a keyword; and you are using that keyword to construct a URL that you are then trying to parse? If that's the case, if possible could you email me an example URL of a request that is causing the Allowed memory size error to occur; as well as the Format String you are using the parse that XML and take a look for you...


Submitted by rubenxela on Mon, 2010-03-29 17:49

Ok orry I found adding ini_set("memory_limit","12M"); at the top of the script.

Submitted by rubenxela on Mon, 2010-03-29 19:10

For sure my script eat lot of ressources !! Because of the functions but first bcause of a very large xml file (500 items with description etc ....)
I never knew that xml method use so much ressources and now that I was so much time doin' it I realy don't want to go back to mysql method for this website !!
I don't know if you do that but maybe I can pay your service for a script optimization !!!

Submitted by support on Mon, 2010-03-29 19:11

Hi there,

The xml functions shouldn't really consume any significant resource - certainly not at least the Magic Parser layer on top of PHP's built in functions.

However, could you check that you don't still have at the top of your script the Magic Parser "autodetect" code that appears in the example code in this thread. If that still exists, an entire scan of your XML source would be going on unnecessarily...!

If it's definitely not there; feel free to email me your script and I'll give it a quick check over - there might be something I can spot quickly for you...

All the best,

Submitted by rubenxela on Thu, 2010-04-15 10:12

Thank you David. It's goin' better with a dedicated server. Thank you very much for your help