内部服务器错误500,运行Yii的内存不足错误

时间:2022-07-08 21:21:23

So I'm running Yii, which has an application that manages some scientific data.

所以我正在运行Yii,它有一个管理一些科学数据的应用程序。

I'm running Apache on CentOS.

我在CentOS上运行Apache。

PHP Version 5.2.10 Apache/2.2.3 (CentOS)

PHP版本5.2.10 Apache / 2.2.3(CentOS)

Here's my error log (obfuscated personal identifying information).

这是我的错误日志(模糊的个人识别信息)。

[Wed Apr 18 15:27:42 2012] [error] [client 000.000.000.000] PHP Notice:  Use of undefined constant \x94512M\x93 - assumed '\x94512M\x93' in /var/www/MySite/www/admin/index.php on line 12, referer: http://MySite.com/admin/index.php?r=factsheet/admin
[Wed Apr 18 15:27:44 2012] [error] [client 000.000.000.000] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 57 bytes) in /var/www/MySite/www/yii/framework/db/ar/CActiveRecord.php on line 1856, referer: http://MySite.com/admin/index.php?r=factsheet/admin

If I remove the renderPartial() out of my view, I can get the page to load, so it appears it's somehow tied into that.

如果我从我的视图中删除了renderPartial(),我可以加载页面,所以看起来它与某种程度相关。

CActiveRecord.php:

protected function instantiate($attributes)
{
    $class=get_class($this);
    $model=new $class(null);
    return $model;
}

My Model:

Extends an abstract class which extends GxActiveRecord. 

View:

<?php

$this->breadcrumbs = array(
    $model->label(2) => array('index'),
    Yii::t('app', 'Create'),
);
$this->menu = array(
    array('label'=>Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')),
    array('label'=>Yii::t('app', 'Manage') . ' ' . $model->label(2), 'url' => array('admin')),
);
?>
<h1><?php echo Yii::t('app', 'Create') . ' ' . GxHtml::encode($model->label()); ?></h1>
<?php
$this->renderPartial('_form', array(
        'model' => $model,
        'buttons' => 'create'));
?>

Line 12 of index.php

index.php的第12行

ini_set(“memory_limit”,”512M“);

Any ideas?

1 个解决方案

#1


4  

The message

[Wed Apr 18 15:27:42 2012] [error] [client 000.000.000.000] PHP Notice:  Use of undefined constant \x94512M\x93 - assumed '\x94512M\x93' in /var/www/MySite/www/admin/index.php on line 12, referer: http://MySite.com/admin/index.php?r=factsheet/admin

indicates, that you missed the $-sign before a variable.

表示您在变量之前错过了$ -sign。

Please provide line 12 of index.php. I don't believe the problem is located in the source provided above.

请提供index.php的第12行。我不相信问题出在上面提供的来源中。

The message

[Wed Apr 18 15:27:44 2012] [error] [client 000.000.000.000] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 57 bytes) in /var/www/MySite/www/yii/framework/db/ar/CActiveRecord.php on line 1856, referer: http://MySite.com/admin/index.php?r=factsheet/admin

frequently indicates a certain looping PHP-operation or complex queries.

经常表示某个循环的PHP操作或复杂的查询。

You could enhance the amount of PHP memory, but this most likely won't solved the actual problem.

你可以增加PHP内存的数量,但这很可能无法解决实际问题。

#1


4  

The message

[Wed Apr 18 15:27:42 2012] [error] [client 000.000.000.000] PHP Notice:  Use of undefined constant \x94512M\x93 - assumed '\x94512M\x93' in /var/www/MySite/www/admin/index.php on line 12, referer: http://MySite.com/admin/index.php?r=factsheet/admin

indicates, that you missed the $-sign before a variable.

表示您在变量之前错过了$ -sign。

Please provide line 12 of index.php. I don't believe the problem is located in the source provided above.

请提供index.php的第12行。我不相信问题出在上面提供的来源中。

The message

[Wed Apr 18 15:27:44 2012] [error] [client 000.000.000.000] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 57 bytes) in /var/www/MySite/www/yii/framework/db/ar/CActiveRecord.php on line 1856, referer: http://MySite.com/admin/index.php?r=factsheet/admin

frequently indicates a certain looping PHP-operation or complex queries.

经常表示某个循环的PHP操作或复杂的查询。

You could enhance the amount of PHP memory, but this most likely won't solved the actual problem.

你可以增加PHP内存的数量,但这很可能无法解决实际问题。