Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Out of Memory - Crashes Apache?
    primarykey
    data
    text
    <p>I am running PHP version 5.3.0 and Apache: 2.2.11</p> <p>When I run PHP scripts that consume a lot of memory (I think) - large loops etc. My Apache web server reports a crash?!</p> <pre><code>[Sat Jan 02 00:51:30 2010] [notice] Parent: child process exited with status 255 -- Restarting. </code></pre> <p>Do I need to increase memory somewhere? I currently have memory set to</p> <pre><code>memory_limit = 512M </code></pre> <p>PHP hasn't complained about this so I am thinking its something else?</p> <p>Thanks all</p> <h2>Update</h2> <p>This error has been logged by my windows machine in the event viewer:</p> <blockquote> <p>Faulting application httpd.exe, version 2.2.11.0, time stamp 0x493f5d44, faulting module php5ts.dll, version 5.3.0.0, time stamp 0x4a4922e7, exception code 0xc0000005, fault offset 0x00083655, process id 0x1588, application start time 0x01ca8b46e4925f90.</p> </blockquote> <h2>Update 2</h2> <p>Script in question. I've removed the URL.</p> <pre><code>&lt;?php error_reporting(E_ALL); set_time_limit(300000); echo 'start&lt;br&gt;'; include_once('simple_html_dom.php'); $FileHandle = fopen('tech-statistics3.csv', 'a+') or die("can't open file"); for($i =1; $i &lt; 101; $i ++){ // Create DOM from URL $html = file_get_html("http://www.x.com/$i"); foreach($html-&gt;find('div[class=excerpt]') as $article) { $item0 = $article-&gt;children(1)-&gt;children(1)-&gt;children[0]-&gt;plaintext; $item1 = $article-&gt;children(1)-&gt;children(1)-&gt;children[0]-&gt;plaintext; $item2 = $article-&gt;children(1)-&gt;children(0)-&gt;children(0)-&gt;children(0)-&gt;plaintext; //$item3 = $article-&gt;children(1)-&gt;children(0)-&gt;children(0)-&gt;children[1]-&gt;children(0)-&gt;next_sibling(); $stringa = trim($item0).",".trim($item1).",".trim($item2)."\r\n"; fwrite($FileHandle, $stringa); echo $stringa.'&lt;br&gt;'; echo '------------&gt;'.$i; } } fclose($FileHandle); echo '&lt;b&gt;End&lt;br&gt;'; ?&gt; </code></pre> <h2>Update 3</h2> <p>I am using the PHP Simple HTML DOM Parser and I have just found this:</p> <p><a href="http://simplehtmldom.sourceforge.net/manual_faq.htm#memory_leak" rel="noreferrer">http://simplehtmldom.sourceforge.net/manual_faq.htm#memory_leak</a></p> <p>I think I should be clearing memory otherwise it will crash. Testing now.</p> <h2>Update4</h2> <p>Yep, it was a memory leak! :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload