dongwei4444 2013-02-14 17:47
浏览 149
已采纳

新控制器中的Zend Framework 404错误问题

I am very new to ZF and I am working on an already built application. My task is to create web service in the application. I have setup the application locally and its working fine. So I have added a new controller and could access in localhost, but when I tried to access the same in server, it results in 404 error, but other controllers can be accessed perfectly.

AllowOverride All and Apache mod_rewrite is enabled in the server. Does anybody have any idea aboout this problem. I am sitting with this error for 2 days ..

    <VirtualHost *:80>
          DocumentRoot /path/to/site/public
          ServerName sitename.com
          ServerAlias www.sitename.com
       <Directory /path/to/site/public>
          AllowOverride All
       </Directory>
    </VirtualHost>

Controller code:

class APIController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */

    }

    public function indexAction()
    {

        // Setup REST server
        $server = new Zend_Rest_Server();
    $server->setClass('APIHandlerClass');
    $server->handle();
    exit;
    }


}  

I am accessing it with the url site.com/API It will show an XML in actual case.

EDIT:

I have setup the application in a local linux system and I found that the problem is related to the linux.

I have tried the following:

  1. Created a new controller which resulted in 404.

  2. Copied an existing controller and renamed the orginal controller's name. Then I have changed the code in copied controller. I accessed the my controller and it worked!

  3. Copied an existing controller and renamed the copied controller. I called the copied controller with new name, which showed 404 error.

My question is do I need to specify the new controller name any where!? I didn't find any documentation regarding this and I even created view files for the controller.

  • 写回答

1条回答 默认 最新

  • douhai9043 2013-02-15 09:07
    关注

    If the application works locally in Windows but doesn't work on the test server running Linux, it's likely to be a case-sensitivity issue. Check the case of folders, including the controllers folder and the views/scripts folders (both should be lower case).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。