run cron cpanel

hello,

I have implement a cron, but the anwser that I receive in my email is:

"This script must be run from the command line."

Cron:




/usr/bin/php -q /home/user/public_html/folder/yiicmd.php test



yiicmd.php file:


<?php

 

// change the following paths if necessary

        $yii=dirname(__FILE__).'/../yii/framework/yii.php';

        $config=dirname(__FILE__).'/protected/config/console.php';

       // $globals=dirname(__FILE__).'/protected/globals/globals.php';

         

        // remove the following line when in production mode

        defined('YII_DEBUG') or define('YII_DEBUG',true);

        

      //  require_once($globals);

        require_once($yii);

        Yii::createConsoleApplication($config)->run();




?>

Can anyone tell me why this happens?

thanks

try this command:


php -i | grep argv

you should see something like this:


register_argc_argv => On => On

_SERVER["argv"] => Array

and btw, which yii version are you using?

result of php -i | greo argv

<tr><td class="e">register_argc_argv</td><td class="v">Off</td><td class="v">Off</td></tr>

This option is off.

My version is the last stable.

ok i resolved with php5 -d register_argc_argv=on …

I also get "This script must be run from the command line"

register_argc_argv is On

[i]user@server [~/public_html/mydomain.co.uk/protected]# php -i | grep argv

register_argc_argv => On => On

_SERVER["argv"] => Array[/i]

Frustration central!

Hello,

Same issue for me also. I am able to run the command from termainal. However when I add this command in cron tab, i get the emails saying, This script must be run from the command line.

Please help if you have found the solution!!!

UP!!!!