dpd46554 2015-11-04 17:00
浏览 63
已采纳

在Doctrine和ini_set中耗尽的允许内存大小不起作用

I am importing a lot of files in a query, problem is I got a PHP error telling me I exhausted all the memories.

But this problem is occurring only on the production server, not in my local.

I already tried to do a

ini_set('memory_limit', '-1');

and a

set_time_limit ( 0 );

And my code is

public function mediachooserAction(Request $request, $origin = null, $type = null, $term = null)
{
    ini_set('memory_limit', '-1');
    if ($this->container->has('profiler')) {
        $this->container->get('profiler')->disable();
    }

    $entities = $this->getRepository('AppBundle:Media')->findMedias($origin, $type, $term);

    $pagerfanta = new Pagerfanta(new ArrayAdapter($entities));
    $pagerfanta->setMaxPerPage(20);
    if ($request->query->has('page')) {
        $pagerfanta->setCurrentPage($request->query->get('page'));
    }

    return $this->render('backend/ckeditor/mediachooser/index.html.twig', [
        'entities'      => $pagerfanta,
        'origin'        => $origin,
        'type'          => $type,
        'originChoices' => Media::getOriginChoices(),
        'typeChoices'   => Media::getTypeChoices(),
    ]);
}

But this isn't helping.

Do you know how I can fix this issue without doing any optimisation in my program ?

  • 写回答

2条回答 默认 最新

  • doukong9982 2015-11-05 09:32
    关注

    I did a php_value memory_limit 512M in the .httpaccess and it works fine now.

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

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置