Magento令人沮丧的内存限制

问题描述 投票:1回答:1

我和Magento合作了很长一段时间,但最近我感到很沮丧,因为我收到了“允许的内存大小”错误。这通常是固定的(根据我的理解)通过增加相关的.htaccess文件中的“php_value memory_limit”,自我启动商店以来,我已将其设置为较高的值。

无论如何,虽然我最近在error_log中收到以下错误:

    PHP Fatal error:  Allowed memory size of 52428800 bytes exhausted (tried to allocate 10282 bytes) in /home/store/public_html/includes/src/__default.php on line 2976
    PHP Fatal error:  Allowed memory size of 52428800 bytes exhausted (tried to allocate 32 bytes) in /home/store/public_html/includes/src/__default.php on line 56485
    PHP Fatal error:  Allowed memory size of 52428800 bytes exhausted (tried to allocate 77 bytes) in /home/store/public_html/includes/src/__default.php on line 56485

如果有帮助,我会指出相关的行如下。 (问题中的行标有** **)

2976:

    try {
        $includeFilePath = realpath($this->_viewDir . DS . $fileName);
        if (strpos($includeFilePath, realpath($this->_viewDir)) === 0 || $this->_getAllowSymlinks()) {
            **include $includeFilePath;**
        } else {
            Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, null, true);
        }

56485:

public function fetchAll($style = null, $col = null)
{
    if ($style === null) {
        $style = $this->_fetchMode;
    }
    try {
        if ($style == PDO::FETCH_COLUMN) {
            if ($col === null) {
                $col = 0;
            }
            return $this->_stmt->fetchAll($style, $col);
        } else {
            **return $this->_stmt->fetchAll($style);**
        }
    } catch (PDOException $e) {
        #require_once 'Zend/Db/Statement/Exception.php';
        throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
    }
}

这里我觉得奇怪的是“52428800字节”,从我的理解转化为50MB。这些50MB可以预定义在哪里?我清楚地检查了我的php信息并且值无处可见,“php_value memory_limit”对应于我之前定义的并且无处接近50MB。

我的Magento设置:

  • Magento 1.5.10
  • 启用Memcache
  • 编译已启用

硬件设置:

  • 带12GB RAM的VPS
  • WHM / cPanel
  • NginxCP

当前的PHP配置:

  • 默认PHP版本(.php文件)5
  • PHP 5 Handler dso
  • PHP 4处理程序无
  • Apache suEXEC上
  • Apache Ruid2上

如果有人能够指出我如何解决这个问题的正确方向,我将非常感激。谢谢。

php magento magento-1.5
1个回答
0
投票

这可以设置

  1. php.ini文件
  2. 您的Apache配置(.htaccesshttp.conf /它包括)
  3. 在运行时调用ini_set

更可能的是,你的webhost已经安装了限制内存的第三方PHP扩展(例如suhosin。我会先花时间联系他们,然后花很多时间追逐鬼魂。

© www.soinside.com 2019 - 2024. All rights reserved.