I was successfully able to create a shell with a task that contains DB
access and get it to run on DreamHost in either SSH or cron. However,
our project lead chose to host the site on HostGator. As you know,
each hosting service differs ever so slightly in their implementation.

At this point I can run my test shell that has no DB access perfectly
on HostGator. The syntax for it is much different than DreamHost. Here
is the command:

php /home/USER NAME/public_html/cake/console/cake.php -app /home/USER
NAME/public_html/cake/app test main

The output is as expected:

Welcome to CakePHP v1.2.1.8004 Console
---------------------------------------------------------------
App : app
Path: /home/USER NAME/public_html/cake/app
---------------------------------------------------------------
Please specify which reminder task to run; LOF or Other.

Now, when I try to use a shell with a task that has a $uses statement
I get an error like this:

php /home/USER NAME/public_html/cake/console/cake.php -app /home/USER
NAME/public_html/cake/app reminders main
Error: Missing Database Connection. Try 'cake bake'

The shell with the function I am trying to execute looks like this:

<?php

class RemindersShell extends Shell {
        var $components = array('SwiftMailer');
        var $tasks = array('SwiftMailer');

        var $uses = array('Repairorder');

        function main() {
                echo "Please specify which reminder task to run; LOF or 
Other.\n\n";
        }

}

?>

The shell is the same as the test shell except with $components,
$tasks, and $uses statements. This works fine on DreamHost that has a
CLI of PHP4. To make it work I did need to change the cake console
file to force PHP5 use, as per this article
http://www.milesj.me/blog/read/83/Setting-Up-Cron-Jobs-With-Cake-Shells
and DreamHost support.

Can anyone spot what is the difference with HostGator so that my shell
with a DB reference does not execute in either SSH or cron? Do you
think I need to change the cake console file? It appears that
HostGator is running PHP5, but I am not sure about the CLI. Thank you
in advance for your help.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to