Reputation: 69
Hi everyone i'm trying to create a rest service using the zend framework I have basicly copied the actual app that this rest service is going to be for. i removed the layout folder and the view folders.
My problem is the modules don't seem to be loading at all and i get the following output when i go to the index.php
problemInvalid controller specified (error)#0 /home/********/*****/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /home/********/*****/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() #2 /home/********/*****/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #3 /home/********/public_html/portal/websvc/index.php(34): Zend_Application->run() #4 {main}
I'm not sure why this isnt working. its basicly the same settings as my original app that has 20 modules and there is no problem with that.
PLEASE HELP! :'(
so i basicly have the following folder structure
/app/modules
/app/modules/v1
/app/modules/v1/controllers
/app/modules/v1/controllers/OutboundController.php
/app/modules/v1/controllers/ProductController.php
/app/modules/v1/Bootstrap.php
/app/modules/default
/app/modules/default/controllers
/app/modules/default/controllers/errorController.php
/app/config/
This is my application.ini
[production]
includePaths.library = APPLICATION_PATH "/../../../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.defaultModule = "v1"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.moduleControllerDirectoryName = "controllers"
resources.router.routes.rest.type = Zend_Rest_Route
My bootstrap.php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initautoloader() {
$autoloader = new Zend_Application_Module_Autoloader(array(
'basePath' => APPLICATION_PATH."/modules/default",
'namespace' => '',
));
$resourceAutoLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath' => APPLICATION_PATH,
'namespace' => '',
));
$resourceAutoLoader->addResourceTypes(array(
"class" => array(
'namespace' => 'Class',
'path' => '/../../../library/Class'
),
"model" => array(
'namespace' => 'Model',
'path' => '/../../../library/Models'
)
));
}
protected function _initFrontModules()
{
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$front->addModuleDirectory(APPLICATION_PATH . '/modules');
}
}
My index.php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../ibwms/applications/external/websvc'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../../library'),
get_include_path(),
)));
/* Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
try{
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
Zend_Controller_Front::getInstance()->setBaseUrl('/portal/websvc/');
$application->bootstrap()
->run();
}catch(Exception $e)
{
echo 'problem'.$e->getMessage();
}
Upvotes: 0
Views: 332
Reputation: 1064
Rename
/app/modules/default/controllers/errorController.php
to
/app/modules/default/controllers/ErrorController.php
Most likely there's an exception and application is trying to display it, but is unable to load the ErrorController
Upvotes: 1