run cron cpanel

(Frederico Rodrigues) #1


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

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


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

yiicmd.php file:



// change the following paths if necessary



       // $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);




Can anyone tell me why this happens?


(Zekus One) #2

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?

(Frederico Rodrigues) #3

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.

(Frederico Rodrigues) #4

ok i resolved with php5 -d register_argc_argv=on …

(Pcmcdermott) #5

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

register_argc_argv is On

[i]user@server [~/public_html/]# php -i | grep argv

register_argc_argv => On => On

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

Frustration central!

(Riyaz) #6


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!!!

(Fogudupappede) #7