I kept getting errors when trying to use the "model User" command from the shell.
example1: Warning: you do not have a 'db' database connection as required by Active Record
example2: exception 'CDbException' with message 'Active Record requires a "db" CDbConnecti
on application component.' in (path to webroot)/yii/framework/db/ar/CActiveRecord.
Stack trace: (followed by a laundry list of errors)
I've tried to figure out how to make the shell command "model User" work, but had no luck untill I looked at which version of php it's using.
…in this case, it was the wrong one since I was using a lamp stack that I got from bitnami.com
so I had to invoke the shell command (i.e. "model User") using the version of php that came with the stack instead of using the OS version of php (running stacks on both mac OS X and Ubuntu 8.04). I also had to include the mysql socket that was on the stack so it won't go to the OS version as well.
here's my array that's in the protected/config/main.php file
then I invoke the command using:
htdocs/testdrive$> /home/michael/lamp/php/bin/php …/yii/framework/yiic shell
and this so far has worked for me