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


Internal Server Error 500, out of memory error running Yii

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

我在 CentOS 上运行 Apache。

PHP 版本 5.2.10Apache/2.2.3 (CentOS)

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

[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

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

CActiveRecord.php:

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

我的模型:

Extends an abstract class which extends GxActiveRecord. 

视图:

<?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'));
?>

索引的第 12 行.php

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

有什么想法吗?

消息

[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

指示您错过了变量前面的 $ 符号。

请提供索引.php的第 12 行。我不认为问题出在上面提供的来源中。

消息

[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

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

您可以增加PHP内存量,但这很可能不会解决实际问题。