title: CakePHP: Allowed memory size exhausted, increasing memory_limit is not helping
body: <p>Specs = CakePHP 2.4.6, PHP 5.3.13, Windows 7 x64, Apache Server 2.4.9.</p>
  
  <p>I keep getting this error:</p>
  
  <pre><code>Allowed memory size xxxx exhausted
  </code></pre>
  
  <p>I have tried everything I could find, increasing <code>memory_limit</code> or <code>max_execution_time</code> inisde php.ini file is not helping no matter how much I increase the limits. My Apache server has openssl enabled (some say it might be related), php_pdo_mysql is enabled too. I am using fastCGI for PHP and it's not helping to switch to php5_module!</p>
  
  <p>The strange thing is that it was working on my localhost for a while and not working on the dev server, and recently it's not working on my localhost as well (I started getting execution time error instead sometimes)</p>
  
  <p>Here is the action I am using:</p>
  
  <pre><code>public function index() {
  
      $this-&gt;Certificate-&gt;recursive = 0; 
      $certificates = $this-&gt;Certificate-&gt;find('all',         
          array(       
          'conditions' =&gt; array('course_id !=' =&gt; '1'),       
          'contain' =&gt; array(
  
                           'CertificateStatus.status',
                           'Course.title',
                           'Student.full_name',
                           'User.name'
  
                   )));
      $this-&gt;set(compact('certificates'));
  }
  </code></pre>
  
  <p>Any ideas as to what could be the reason for this problem? how would I find memory leaks in CakePHP? What could be the solution to fix/optimize it?</p>
  
  <p>** New Update:</p>
  
  <p>After limiting the number of "fields" in the <code>find()</code>, and after increasing some Fcgid numbers inside httpd, now I can fetch the whole table, but it takes 5 minutes for the page to load completely, which is a failure performance wise!</p>
  
  <p>Is this related to CakePHP caching? If yes, is there any way to optimize it for this number of records?? Everyone tells me that 26,000 text records is not a "huge" data set!</p>