Andy
Andy

Reputation: 727

Running Zend Framework as CLI doesnt work in linux but does on Windows

I need to be able to run my application through cron on a linux ( debian machine )

As such i have created a cron.php which only loads the relevant bootstrap stuff i need i also force the default module to be 'cron' as opposed to the current default.

i run the cron as such:

cron.php action=[actionname] controller=[contollername]

i have setup a router to take the parameters from the cli and use it within my application. In my current case it will force the action and controller to be what has been asked

$getopt     = new Zend_Console_Getopt (array ());
$arguments  = $getopt->getRemainingArgs();

.... set controller correctly using arguments 
.... do other stuff

$dispatcher->setControllerName($controller);
$dispatcher->setActionName($action);
$dispatcher->setParams($params);

when i run the following on windows i get what i expect, which is the controller and action loads - executing the code as expected

c:\php -c [path_to_ini] -f cron.php action=send controller=mail

but when i run the exact same code on linux i get a strange exception:

:~$ php -c [path_to_ini] -f [path_to_cron]cron.php controller=mail action=send

Exception Found:
    Name: Zend_Controller_Dispatcher_Exception
    Message:Cannot load controller class "IndexController" from file "[path_to_application]/modules/cron/controllers/IndexController.php'

Stack Trace:
0 [path_to_zend]/Controller/Dispatcher/Standard.php(262): Zend_Controller_Dispatcher_Standard->loadClass('IndexController')
1 [path_to_zend]/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Simple), Object(Zend_Controller_Response_Http))
2 [path_to_zend]/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
3 [path_to_zend]/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
4 [path_to_application]/public/cron.php(36): Zend_Application->run()

why might linux be loading a different controller than windows. i am quite to very stumped.

thanks in advance

additional health notes:

dumping the controller and action within my router shows that i'm properly setting the controller and action on both *nix and doze.

I've tried looking within /Zend/Controller/Dispatcher/Standard.php(262) and it seems at this point the controller has changed.

Upvotes: 1

Views: 362

Answers (1)

Sam
Sam

Reputation: 16455

Most likely when something works well on Windows and not on Linux it is a problem with upper/lower case mismatches. I would look for this first ;)

Upvotes: 2

Related Questions