dprlv04662 2014-07-21 17:52
浏览 51

CakePHP:允许的内存大小耗尽,增加memory_limit没有帮助

Specs = CakePHP 2.4.6, PHP 5.3.13, Windows 7 x64, Apache Server 2.4.9.

I keep getting this error:

Allowed memory size xxxx exhausted

I have tried everything I could find, increasing memory_limit or max_execution_time 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!

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)

Here is the action I am using:

public function index() {

    $this->Certificate->recursive = 0; 
    $certificates = $this->Certificate->find('all',         
        array(       
        'conditions' => array('course_id !=' => '1'),       
        'contain' => array(

                         'CertificateStatus.status',
                         'Course.title',
                         'Student.full_name',
                         'User.name'

                 )));
    $this->set(compact('certificates'));
}

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?

** New Update:

After limiting the number of "fields" in the find(), 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!

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!

  • 写回答

4条回答 默认 最新

  • dongyoufo5672 2014-07-22 05:30
    关注
    ini_set('memory_limit', '-1'); 
    

    overrides the default PHP memory limit.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)