我正在导入一个查询中的很多文件,问题是我得到一个PHP错误,告诉我我耗尽了所有的回忆。在Doctrine和ini_set中耗尽的内存大小不起作用
但是这个问题只发生在生产服务器上,而不是在我的本地。
我已经尝试过做一个
ini_set('memory_limit', '-1');
和
set_time_limit (0);
而且我的代码是
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(),
]);
}
但是,这并没有帮助。
您是否知道我可以如何解决此问题,而无需在我的程序中进行任何优化?
您的托管服务可以忽略这样的配置:内存或时间限制... –
@HalayemAnis我有root访问权限,我检查了php.ini,一切似乎都没问题... –