Reputation: 6195
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:
Created a new controller which resulted in 404.
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!
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.
Upvotes: 1
Views: 1638
Reputation: 33148
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).
Upvotes: 4