dongshiliao7990 2014-01-14 18:08
浏览 72
已采纳

PHP内存不足,但仅限于一个系统

I have been working for the last few months on a CakePHP application.
Most of this time I was developing on Lubuntu, using lampp package.
Everything works fine in this setting, as it does on two different remote servers I have access to.
Few days ago circumstances forced me to move with the development to a laptop device with Windows 7 as an OS.
And the application doesn't work here. php_error_log contained Allowed memory size of 134217728 bytes exhausted.
I've switched memory_limit to -1 in php.ini, and now it's PHP Fatal error: Out of memory (allocated 1488453632) (tried to allocate 15470592 bytes)
This smells like an infinite loop, but the application still works correctly on other servers. And other applications, including freshly downloaded Cakephp package, work fine on this device.

I'm confused with the apparent exclusiveness of this error. I can provide additional information if you tell me what should I check.

Update:
-recursive was at 3, but setting it to -1 haven't changed anything. Also, in most cases we set recursive individually for each find(...) call.
-setting debug to 0 brings no noticeable changes.

Update2:
I have solved the issue, sort of. I'll Provide details in the answer.

  • 写回答

2条回答 默认 最新

  • dpgua04022 2014-01-27 17:15
    关注

    I have found the source of the problem, although I only understand it partially. The reason lies in \lib\Cake\Model\Datasource\CakeSession.php :

    if (ini_set($setting, $value) === false) {
    throw new CakeSessionException(sprintf(
        __d('cake_dev', 'Unable to configure the session, setting %s failed.'),
        $setting
    )); }
    

    This line was throwing the exception over and over for setting session.auto_start. It appears that the expression 0 === false incorrectly returned true. I assume that because phpinfo() displays that session.autostart is off. I could print out the value just before the block in question, but if for some unknown reason comparison really is wrong, then why would printing be correct? I don't have the time to investigate this further. I have commented the exception for the time of development. On production server everything works fine.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂