Yii Framework Forum: Console App don't start - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Console App don't start Rate Topic: -----

#1 User is offline   raragao 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 08-January 09

Posted 23 March 2009 - 02:37 PM

Hi,

I'm attempt config a console application, but it doesn't work.
I created the below class into folder protected/commands:

class IWCTProcessor extends CConsoleCommand {
    public function run($args) {
        $user = $args[0];
        print $user;
    }
}


I created a entry script as showed in manual. When I execute the below command:

$ php entryScript.php help

I received a response:

$ php entryScript.php help
Usage: entryScript.php <command-name> [parameters...]

The following commands are available:
- iwctprocessor

To see individual command help, use the following:
  entryScript.php help <command-name>


But, when I execute the complete command below:

$ php entryScript.php iwctprocessor teste

The error below is showed:

$ php entryScript.php iwctprocessor teste
PHP Error[2]: YiiBase::include(IWCTProcessorCommand.php): failed to open stream: No such file or directory
in file F:DesenvolvimentoworkspacesphpyiiframeworkYiiBase.php at line 297
#0  CConsoleApplication->displayError(2, YiiBase::include(IWCTProcessorCommand.php): failed to open stream: No such file or d
irectory, F:DesenvolvimentoworkspacesphpyiiframeworkYiiBase.php, 297) called at [F:Desenvolvimentoworkspacesphpyii
frameworkbaseCErrorHandler.php:175]
#1  CErrorHandler->handleError(CErrorEvent Object ([code] => 2,[message] => YiiBase::include(IWCTProcessorCommand.php): faile
d to open stream: No such file or directory,[file] => F:DesenvolvimentoworkspacesphpyiiframeworkYiiBase.php,[line] => 2
97,[sender] => CConsoleApplication Object ([commandMap] => Array (),[] => F:Desenvolvimentoworkspacesphpiwctprotectedco
mmands,[] => CConsoleCommandRunner Object ([commands] => Array ([iwctprocessor] => F:Desenvolvimentoworkspacesphpiwctpro
tectedcommandsIWCTProcessorCommand.php),[] => entryScript.php,[] => ,[] => ),[name] => IWCT Processor Console Command,[char
set] => UTF-8,[preload] => Array (),[sourceLanguage] => en_us,[behaviors] => Array (),[] => ,[] => F:Desenvolvimentoworkspa
cesphpiwctprotected,[] => ,[] => ,[] => ,[] => ,[] => ,[] => Array ([errorHandler] => CErrorHandler Object ([maxSourceLine
s] => 25,[adminInfo] => the webmaster,[discardOutput] => 1,[behaviors] => Array (),[] => 1,[] => ,[] => )),[] => Array ([core
Messages] => Array ([class] => CPhpMessageSource,[language] => en_us,[basePath] => F:Desenvolvimentoworkspacesphpyiifram
eworkmessages),[db] => Array ([class] => CDbConnection),[messages] => Array ([class] => CPhpMessageSource),[securityManager]
=> Array ([class] => CSecurityManager),[statePersister] => Array ([class] => CStatePersister)),[] => ,[] => ,[] => ,[] => ),
[handled] => 1,[] => ,[] => )) called at [F:DesenvolvimentoworkspacesphpyiiframeworkbaseCErrorHandler.php:87]
#2  CErrorHandler->handle(CErrorEvent Object ([code] => 2,[message] => YiiBase::include(IWCTProcessorCommand.php): failed to
open stream: No such file or directory,[file] => F:DesenvolvimentoworkspacesphpyiiframeworkYiiBase.php,[line] => 297,[s
ender] => CConsoleApplication Object ([commandMap] => Array (),[] => F:Desenvolvimentoworkspacesphpiwctprotectedcommand
s,[] => CConsoleCommandRunner Object ([commands] => Array ([iwctprocessor] => F:Desenvolvimentoworkspacesphpiwctprotecte
dcommandsIWCTProcessorCommand.php),[] => entryScript.php,[] => ,[] => ),[name] => IWCT Processor Console Command,[charset]
=> UTF-8,[preload] => Array (),[sourceLanguage] => en_us,[behaviors] => Array (),[] => ,[] => F:Desenvolvimentoworkspacesp
hpiwctprotected,[] => ,[] => ,[] => ,[] => ,[] => ,[] => Array ([errorHandler] => CErrorHandler Object ([maxSourceLines] =>
25,[adminInfo] => the webmaster,[discardOutput] => 1,[behaviors] => Array (),[] => 1,[] => ,[] => )),[] => Array ([coreMessa
ges] => Array ([class] => CPhpMessageSource,[language] => en_us,[basePath] => F:Desenvolvimentoworkspacesphpyiiframework
messages),[db] => Array ([class] => CDbConnection),[messages] => Array ([class] => CPhpMessageSource),[securityManager] => A
rray ([class] => CSecurityManager),[statePersister] => Array ([class] => CStatePersister)),[] => ,[] => ,[] => ,[] => ),[hand
led] => 1,[] => ,[] => )) called at [F:DesenvolvimentoworkspacesphpyiiframeworkbaseCApplication.php:620]
#3  CApplication->handleError(2, YiiBase::include(IWCTProcessorCommand.php): failed to open stream: No such file or directory
, F:DesenvolvimentoworkspacesphpyiiframeworkYiiBase.php, 297, Array ([className] => IWCTProcessorCommand)) called at [F
:DesenvolvimentoworkspacesphpyiiframeworkYiiBase.php:297]
#4  YiiBase::autoload() called at [F:DesenvolvimentoworkspacesphpyiiframeworkYiiBase.php:297]
#5  YiiBase::autoload(IWCTProcessorCommand)
#6  spl_autoload_call(IWCTProcessorCommand) called at [F:DesenvolvimentoworkspacesphpyiiframeworkconsoleCConsoleComman
dRunner.php:129]
#7  CConsoleCommandRunner->createCommand(iwctprocessor) called at [F:DesenvolvimentoworkspacesphpyiiframeworkconsoleCC
onsoleCommandRunner.php:60]
#8  CConsoleCommandRunner->run(Array ([0] => entryScript.php,[1] => iwctprocessor,[2] => teste)) called at [F:Desenvolviment
oworkspacesphpyiiframeworkconsoleCConsoleApplication.php:88]
#9  CConsoleApplication->processRequest() called at [F:DesenvolvimentoworkspacesphpyiiframeworkbaseCApplication.php:17
0]
#10 CApplication->run() called at [F:DesenvolvimentoworkspacesphpiwctentryScript.php:11]


Anybody can help me?
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,901
  • Joined: 04-October 08
  • Location:DC, USA

Posted 23 March 2009 - 02:46 PM

Your command class has to be named as XyzCommand, where Xyz stands for the command name.
0

#3 User is offline   raragao 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 08-January 09

Posted 23 March 2009 - 02:49 PM

Hi,

I'm sorry, I put name of File, but I forget put name on Class.

Thanks.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users