vineri, 18 februarie 2011

All New Phawville

All New Phawville


How to Fix Simple HTML Dom Memory Exhaustion Problem

Posted: 18 Feb 2011 05:45 AM PST

How to Fix Simple HTML Dom Memory Exhaustion Problem. Have you encountered an error such as this when trying to use the Simple HTML Dom script?

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /home2/asdasd/public_html/labs/lib/simple_html_dom.php on line 750

If yes, then you’ve got yourself a memory exhaustion problem! The Simple HTML Dom script is a very cool script to parse HTML documents but in terms of memory management it is not that cool. Fortunately, there is a simple solution to this problem. Simply allocate more memory dynamically! Add this line of code at the top of your PHP script:

ini_set(“memory_limit”,”200M”);

The “200M” is variable so change it to whatever suits your needs. I believe by default, PHP allocates 64M as the memory limit.

Check out the ff links for more information on this:

  • http://www.php.net/manual/en/ini.core.php#ini.memory-limit
  • http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes

Niciun comentariu:

Trimiteți un comentariu