If you just want to trigger a cake action from the commandline, use
wget or curl to request your full URL. Much easier, don't need to hack
anything.
On May 11, 4:55 am, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hi Chris,
>
> yeah the problem was in my code and i got that fixed. but now i am facing
> another problem. I have changed my webroot/index.php to handle command line
> jobs as follows:
>
> if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
> }
> *else if(php_sapi_name() === "cli")
> {
> // this is a command line call - dispatch it with the argument
> define('CRON_DISPATCHER',true);
> $Dispatcher=new Dispatcher();
> $Dispatcher->dispatch($argv[1]);
> }
> * else {
> $Dispatcher = new Dispatcher();
> $Dispatcher->dispatch($url);
> }
> now when i execute php from command line as : php
> c:/www/webroot/Cake/app/webroot/index.php /mycontroller/action, it works
> well but when i pass this to exec function like:
> exec ('php c:/www/webroot/Cake/app/webroot/index.php /mycontroller/action');
>
> it gives me an error saying :
>
> Cannot redeclare class cakesession in
> c:\www\webroot\Cake\cake\libs\session.php on line 789
>
> Any idea on what this can be?
>
> Thanks.
>
>
>
> On Sat, May 10, 2008 at 6:49 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
> > On Fri, May 9, 2008 at 4:54 PM, Novice Programmer
> > <[EMAIL PROTECTED]> wrote:
> > > Hello,
>
> > > I used to run php CLI thro exec function passing it the required php
> > file. I
> > > know want to port this code to Cake PHP semantics but the problem i am
> > > facing is that Cake has got seprate ways to execute on linux and on
> > windows.
> > > on *nix it must be ./cake(as m on a shared host) console applicaiton and
> > on
> > > windows it should be cake.bat. I am developing on windows system and
> > > deploying on linux system. How do i work around this problem?
>
> > What is it that you're trying to do that you think you need to use the
> > Cake console for?
>
> > It has also been my experience that as long as you put the Cake
> > console script in your path, and the PHP executable in your path, it
> > does not matter if you're on Linux or Windows.
>
> > --
> > Chris Hartjes
> > Internet Loudmouth
> > Motto for 2008: "Moving from herding elephants to handling snakes..."
> > @TheKeyBoard:http://www.littlehart.net/atthekeyboard
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---