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.
php:582
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.
$>which php
/usr/bin/php
...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
'db'=>array(
'connectionString'=>'mysql:host=localhost;dbname=yiidb;unix_socket=/home/michael/lamp/mysql/tmp/mysql.sock',
'username'=>'root',
'password'=>'pw',
'charset'=>'utf8'
)
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
Page 1 of 1
MAMP/LAMP STACK + database connectivity
#2
Posted 24 March 2009 - 02:07 AM
I also have a problem when trying to use the "model User" command from the shell. i get an
" driver not found"
with MAMP in Leopard.
The PDO extension are ok
My connection string is
'db'=>array(
'class'=>'CDbConnection',
'connectionString'=>'mysql:host=localhost;port=8889;dbname=yii',
'username'=>'root',
'password'=>'root',
),
" driver not found"
with MAMP in Leopard.
The PDO extension are ok
My connection string is
'db'=>array(
'class'=>'CDbConnection',
'connectionString'=>'mysql:host=localhost;port=8889;dbname=yii',
'username'=>'root',
'password'=>'root',
),
#4
Posted 24 March 2009 - 09:43 AM
I have try with as suggest but an error occur
imac-di-andrea-bersi:testdrive abmcr$ php -c /Applications/MAMP/conf/php5/php.ini /Applications/MAMP/htdocs/testdrive/protected/yiic.php shell
dyld: NSLinkModule() error
dyld: Library not loaded: /Users/severin/Dev/Projects/MAMP_1.7_src/lib/libltdl.3.dylib
Referenced from: /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/mcrypt.so
Reason: image not found
Trace/BPT trap

imac-di-andrea-bersi:testdrive abmcr$ php -c /Applications/MAMP/conf/php5/php.ini /Applications/MAMP/htdocs/testdrive/protected/yiic.php shell
dyld: NSLinkModule() error
dyld: Library not loaded: /Users/severin/Dev/Projects/MAMP_1.7_src/lib/libltdl.3.dylib
Referenced from: /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/mcrypt.so
Reason: image not found
Trace/BPT trap
#5
Posted 24 March 2009 - 10:25 AM
Disable these extensions then (in your php.ini) They are not crucial.
Share this topic:
Page 1 of 1

Help











