为什么 Magento 网站的前端无法加载? - 致命错误:类“Mage__Helper_Data”未找到

发布于 2024-12-04 08:27:43 字数 1538 浏览 0 评论 0原文

我的 magento 网站前端出现问题,它抛出 500 错误。后端管理绝对良好且功能齐全,我可以毫无问题地登录,并且不会丢失产品数据。

我在 index.php 文件中取消了第 70 行的注释 -

#ini_set(\'display_errors\', 1);

为了查看错误,这就是您加载网站前端时显示的内容 - 致命错误:Class \'Mage__Helper_Data\ ' 在第 520 行 /var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/Mage.php 中找不到

我认为这里的双下划线是要做的缺少模块或其他东西。

在我刷新管理区域中的所有缓存类型后,这个问题就暴露出来了,但我怀疑问题事先就存在,但在缓存刷新后才暴露出来。

到目前为止,我已经尝试/检查过 -

  • 删除 var/cache、var/session 的内容

  • 基本 URL数据库中的基本 URL 是正确的

  • 将所有目录设置为 755 权限,将所有文件设置为 644,我还尝试根据其他人的建议将 index.php 设置为 755 和 777论坛。

  • 检查了 htaccess,一切似乎都很好。

  • 物理文件都在服务器上。

  • system.log 似乎始终指向 Autoload.php 中的第 93 行 -

    2011-09-12T15:18:52+00:00 ERR (3): 警告: include() [function.include ;]: 无法打开 \'Mage//Helper/Data.php\' 进行包含(include_path=\'/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/local:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/c颂歌/社区:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/core:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/lib:.:\' )在 /var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/lib/Varien/Autoload.php 第 93 行
    

我能想到的其他事情我最近所做的包括通过管理添加谷歌分析,更改顶部链接的代码app\design\frontend\default\blue_toys\template\page\html\header.phtml 中的站点并输入一些 paypal 详细信息以设置支付网关。

安装细节- 版本-1.5.0.1, 主题 - 自定义安装主题

有人可以帮忙吗? 谢谢, 卢克

I’ve got an issue with the front end of a magento site, it is throwing a 500 error. The back end admin is absolutely fine and functional, I'm able to log in no problem and there is no loss of product data.

I have un-commented out line 70 in my index.php file -

#ini_set(\'display_errors\', 1);

in order to see the errors, and this is what now displays when you load up the front end of the site - Fatal error: Class \’Mage__Helper_Data\’ not found in /var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/Mage.php on line 520

I reckon the double underscore here is to do with a module being missing or something..

This problem came to light after I refreshed all cache types in the admin area, but I suspect the problem was there beforehand but just bared it’s head after the cache refresh.

So far I have tried/checked -

  • deleting the contents of var/cache, var/session

  • The base URL in the db is correct

  • made all directories 755 permissions, and all files 644, I have also tried making index.php 755, and 777 on suggestion from other forums.

  • checked htaccess, all seems fine.

  • the physical files are all there on the server.

  • system.log seems to be consistently pointing to line 93 in Autoload.php -

    2011-09-12T15:18:52+00:00 ERR (3): Warning: include() [<a href=\'function.include\'>function.include</a>]: Failed opening \'Mage//Helper/Data.php\' for inclusion (include_path=\'/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/local:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/community:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/app/code/core:/var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/lib:.:\')  in /var/www/vhosts/beta.mydomain.com/httpdocs/countrytoys/lib/Varien/Autoload.php on line 93
    

Other things I can think of that I have recently done include adding google analytics through admin, altering the code for links at the top of the site in app\design\frontend\default\blue_toys\template\page\html\header.phtml and entering some paypal details in order to set up the payment gateway.

installation details -
ver -1.5.0.1,
Theme - custom installed theme

Can anyone help?
thanks,
Luke

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

听,心雨的声音 2024-12-11 08:27:43

您的错误消息在 MageHelper 之间显示两个下划线,而通常只有一个下划线。对我来说,你似乎在MageHelper之间丢失了一个单词,因为通常Mage helper标识符就像Mage_Core_Helper_Data一样。

我首先检查 /etc/config.xml 文件的 部分是否有错误的定义。

除此之外,我可能会尝试在 Varien_Autoload::autoload 方法中获取调试跟踪。

我会寻找参数 $class 中的模式,这可能会导致像 Mage__Helper_Data 这样的 s/t,例如 $class 包含空格或双下划线:

public function autoload($class)
{

    try {
        if (strpos($class, ' ') !== false || strpos($class, '__') !== false) {
            throw new Exception('fishy');
        }
    }
    catch (Exception $e) {
        var_dump($class, $e->getTraceAsString());
        die('stop');
    }

    // original method code starts here
    // :

}

Your error message shows two underscores between Mage and Helper, where there usually is only one of them. For me it looks like you lost a word between Mage and Helper somewhere, as usually Mage helper identifiers are s/t like Mage_Core_Helper_Data.

I'd check the <helpers> sections of my /etc/config.xml files for wrong definitions first.

Other than that I'd probably try to get a debug trace inside the Varien_Autoload::autoload method.

I'd lookout for patterns in the parameter $class which could result in s/t like Mage__Helper_Data, e.g. occurences where $class contains spaces or double underscores:

public function autoload($class)
{

    try {
        if (strpos($class, ' ') !== false || strpos($class, '__') !== false) {
            throw new Exception('fishy');
        }
    }
    catch (Exception $e) {
        var_dump($class, $e->getTraceAsString());
        die('stop');
    }

    // original method code starts here
    // :

}
万劫不复 2024-12-11 08:27:43

我有一个类似的问题,这个问题出现在谷歌结果中,所以我认为为其他遇到同样问题的人添加一个答案是明智的。对于我的问题,它与我尝试在 Magento 配置系统中使用的自定义 有关。

我使用了 Magento 中的示例代码,如下所示:

public function toOptionArray()
    {
        return array(
            array('value' => 0, 'label' => Mage::helper()->__('First item')),
            array('value' => 1, 'label' => Mage::helper()->__('Second item')),
            array('value' => 2, 'label' => Mage::helper()->__('third item'))
        );
    }

错误来自 Mage::helper() 位 - 没有加载帮助程序。您可以将其更改为这样,或加载特定的帮助程序:

public function toOptionArray()
    {
        return array(
            array('value' => 0, 'label' => 'First item'),
            array('value' => 1, 'label' => 'Second item'),
            array('value' => 2, 'label' => 'third item')
        );
    }

I had a similar problem, and this question appeared in the Google results, so I thought it would be sensible to add an answer here for anyone else struggling with the same problem. With my issue, it was related to a custom <source_model> I was trying to use in the Magento configuration system.

I used the example code from Magento, which looks like this:

public function toOptionArray()
    {
        return array(
            array('value' => 0, 'label' => Mage::helper()->__('First item')),
            array('value' => 1, 'label' => Mage::helper()->__('Second item')),
            array('value' => 2, 'label' => Mage::helper()->__('third item'))
        );
    }

The error was coming from the Mage::helper() bit - no helper was being loaded. You can change it to this, or load a specific helper:

public function toOptionArray()
    {
        return array(
            array('value' => 0, 'label' => 'First item'),
            array('value' => 1, 'label' => 'Second item'),
            array('value' => 2, 'label' => 'third item')
        );
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文