<?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/../../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/console.php';
// remove the following lines when in production mode
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();
and your config/console.php as is
imageCacheCleaner class must be in protected/commands
Try Image_cache_cleanerCommand as well. I’m not sure if camel case can cause problem.
Can you call yiic directly? You don’t need to pipe this through /usr/bin/php. All you have to do is set yiic executable (chmod a+x yiic).
For my example above: It works from anywhere, no matter if i’m in the directory or use the full path to yiic. Can you do some tests with the same example i posted (using a fresh clean webapp)? Just to make sure it’s your environment, not some misconfiguration.
Now it is working…but I don’t know if this is a good solution ? hahaha…because what he actually does is recommand the script then call the crontab from the shell…
But, I will try your solution later on. Thanks a lot for this info…wil keep you updated.
You also might want to add the php and yiic location in the PATH environment variable of Windows and reboot your computer if using XAMPP… Was having similar issues but resolved it… never really had any problems until started mucking around with commands in yii…
This article is for WAMP (below is the link) but gives you the general idea on how to configure them…
I followed the instructions above that Mike posted for the console app and it works like a charm. However, it doesn’t work when you have layed out the yii app directory structure differently then what’s generated with the yiic tool.
My directory structure looks like this:
approot
approot/protected
approot/runtime
approot/www <-- location of web accessible assets/js/css/themes/index.php entry script
approot/yii <-- symlink to the latest yii framework lib
I’ve created the console entry script here:
approot/protected/scripts/myscript.php
and the commands in the default loc:
approot/protected/commands/MyCommand.php
2 problems here:
1)When I run the following command to use the local yiic tool in my app nothing is executed.
> approot/protected/yiic
>> doesn’t show me the commands available
2)When i run the command from within the scripts folder like so:
> yiic myCommand
>> doesn’t output any errors or anything
Can anyone here please advise how to resolve this, as it appears to be a configuration issue? Many thanks!