Magento Controller在Windows而非Linux上运行 [英] Magento Controller Works Windows, not Linux

查看:85
本文介绍了Magento Controller在Windows而非Linux上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个可以在Windows XAMPP安装中使用的模块.但是,在Linux上进行测试似乎无法正常进行.更具体地说,我的控制器似乎没有加载.

I have created a module that works on my Windows XAMPP installation. Testing on Linux, however, does not seem to work correctly. More specifically, my controller does not seem to load.

访问网址www.mysite.com/modulename/standard/时,出现404错误.我希望收到一条消息,输出在控制器中类定义之前的die('here').

When visiting the url www.mysite.com/modulename/standard/ I am getting a 404 error. I am expecting to get a message outputting the die('here') that precedes the class definition in the controller.

控制器文件为/app/code/local/Namespace/Modulename/controllers/StandardController.php.

该类在此文件内定义,如下所示:

The class is defined inside this file like so:

class Namespace_Modulename_StandardController extends Mage_Core_Controller_Front_Action

我的XML配置文件的摘录在这里:

The extract from my XML config file is here:

<frontend>      
    <routers>
        <modulename>
            <use>standard</use>
            <args>
                <module>Namespace_Modulename</module>
                <frontName>modulename</frontName>
            </args>
        </modulename>
    </routers>
    <!-- other blocks here -->
</frontend>

我最初的想法是,这是区分大小写的问题,我在Windows上开发时并未注意到. XML片段以前如下,但也无法正常工作.还请注意,我已经尝试访问两个XML版本的www.mysite.com/Modulename/standardwww.mysite.com/modulename/standard,每次都出现404错误.

My initial thought was that it was a case sensitivity issue that I hadn't noticed by developing on Windows. The XML fragment was previously as follows, which also did not work. Please also note that I have tried visiting www.mysite.com/Modulename/standard and www.mysite.com/modulename/standard for both XML versions, with a 404 error every time.

<Modulename>
    <use>standard</use>
    <args>
        <module>Namespace_Modulename</module>
        <frontName>Modulename</frontName>
    </args>
</Modulename>

有人知道可能是什么问题吗?

Does anybody know what could be the problem?

谢谢.

修改

根据要求,这是模块的配置文件.这一切似乎都是正确的-模块显示在Admin/Developer页面中,而模块配置屏幕(在system.xml中生成)显示在后端.而且,模块的某些部分(似乎是控制器)正在前端工作!

As requested, here is the module's config file. This all seems to be correct - the module is displayed in the Admin/Developer page and the module configuration screen (generated in system.xml) appears in the backend. Moreover, parts of the module (and seemingly the controller) are working in the frontend!

<config>
<modules>
    <Namespace_Modulename>
        <active>true</active>
        <codePool>local</codePool>
    </Namespace_Modulename>
</modules>
</config>

编辑2

某些版本可能被证明是有用的. PHP 5.3 Magento 1.5.1.0

Some versions may prove useful. PHP 5.3 Magento 1.5.1.0

推荐答案

我不敢相信!

似乎我的开发箱在我不知情的情况下进行了更新,在此过程中,我的Apache配置发生了更改!我终于意识到,我没有收到Magento的通常的404错误页面,而只是一个普通的,丑陋的404页面,然后检查了我的Apache错误日志,该日志指出文件/Modulename/standard不存在.更新我的Apache配置以添加以下内容以解决问题:

My development box was updated without my knowledge, it would seem, and in the process my Apache configuration was changed! I finally realized that I wasn't receiving Magento's usual 404 error page and only a plain, ugly 404 page, and checked my Apache error logs which said that the file /Modulename/standard didn't exist. Updating my Apache configuration to add the following fixed the problem:

<Directory "mymagentodirectory">
AllowOverride All
</Directory>

我不敢相信.感谢所有花时间阅读和回复的人! :)

I can't believe that. Thanks to all who took the time to read and reply! :)

这篇关于Magento Controller在Windows而非Linux上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆