Cron Calling Old Php File Even Though File Is Changed

I was having a cron set as consol application. When i set it was having errors and i fixed those and updated with new file. Even after edited the file, cron still calling old code with errors. Not sure from where it is getting that code . New file does not have that function at all.

Any idea why? Is there any cache file for cron?

Thanks in Advace

I think this might depend on your host instead of Yii.

Next, were did you replaced the code? Perhaps it is in the wrong directory?

Do you use the commands folder?

What you might want to try is to locate the problem, by executing the command manually

via command line. Then you can see what might cause the problem (debugging).

Hope this action can help you find the issue.

Yes we do have specific folder /home/develgl/public_html/protected/commands/CronXmlCommand.php

I tried to run script directly

/usr/bin/php /home/develgl/public_html/cron.php CronXml

Still same error from old version of file.

And you are sure that both cron.php and CronXmlCommand.php are the latest versions?

Can’t you just modify the cronxml in test-mode, do a


die('test');

and verify if indeed the correct files are modified? Is also the config/console.php updated?

Since, I do not have enough information, when above did not help, can you provide the errors that you retrieve? Then I/we can see whether this is a programm error or of Yii.

Hope this helps.

Thanks For reply,

For testing i reduced by code to

#######################

class CronXmlCommand extends CConsoleCommand

{

/**


 * Execute the action.


 * @param array command line parameters specific for this command


 */


public function run($args)


{  





	die('test');

}

}

###############################

Now when i run /usr/bin/php /home/develgl/public_html/cron.php CronXml

i still get this error.

<b>Fatal error</b>: Call to undefined method GCActiveRecord::xmlGeneration() in <b>/home/develgl/public_html/protected/commands/CronXmlCommand.php</b> on line <b>81</b><br />

################################

Actualy there is no such line in this file. My intial file was having that line and i removed the file to one as above for testing. Still it executing old file.

I have no clue how this happening…Very strange

Thanks

That’s indeed quite strange.

Have you tried the ‘older’ version of crons in Yii, or the newer one?

What you might want to do is check whether everything is in right position, double check all settings in cron.php and the config/console.php.

By the way: Why is your cron.php in the root? Mine is located in protected, in the same folder as yiic.php

If everything is correctly, try to add a function in your Command actionIndex(){}. And leave function run(){} empty or use it for initialization. Then you can call it using


/usr/bin/php /home/develgl/public_html/cron.php CronXml index 

Just so show my code for potential differences:

(cron.php, in protected [!]):




<?php

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

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

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

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

require_once($yii); 


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

?>



config/console.php


<?php


// This is the configuration for yiic console application.

// Any writable CConsoleApplication properties can be configured here.

return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'Console Name',


	// preloading 'log' component

	'preload'=>array('log'),

	

	'import'=>array(

		'application.models.*',

		'application.components.*',

	),


	// application components

	'components'=>array(

		'db'=>array(

			....

		),

		

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

                array(

                    'class'=>'CFileLogRoute',

                    'logFile'=>'cron.log',

                    'levels'=>'error, warning',

                ),

                array(

                    'class'=>'CFileLogRoute',

                    'logFile'=>'cron_trace.log',

                    'levels'=>'trace',

                ),

            ),

		),

	),

	

	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']

	'params'=>array(

		// this is used in contact page

		'adminEmail'=>'mail@example.org',

	),

);

protected/commands/commandNameCommand.php


class commandNameCommand extends CConsoleCommand {

...

}

Hope this helps?

Thanks for coming back.

Still no luck.

Yes i am using old version .

I got same setting as you got.

Strange thing is it was working before.

so it looks like more server related issue rather than Yii.

Finaly managed to sort the issue. it was with WHM and PHP.

replaced

/usr/bin/php /home/develgl/public_html/cron.php CronXml

to

/usr/local/bin/php /home/develgl/public_html/cron.php CronXml