Yii Framework Forum: MAMP/LAMP STACK + database connectivity - Yii Framework Forum

Jump to content

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

MAMP/LAMP STACK + database connectivity Rate Topic: -----

#1 User is offline   redlettermike 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 13-February 09

Posted 13 February 2009 - 01:08 PM

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
0

#2 User is offline   bersi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-March 09

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',
        ),




0

#3 User is offline   qiang 

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

Posted 24 March 2009 - 06:56 AM

Did you check this? http://www.yiiframew...doc/cookbook/7/
0

#4 User is offline   bersi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-March 09

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
???




0

#5 User is offline   qiang 

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

Posted 24 March 2009 - 10:25 AM

Disable these extensions then (in your php.ini) They are not crucial.
0

#6 User is offline   bersi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 24-March 09

Posted 24 March 2009 - 10:33 AM

Ok thank you: all work fine now. I continue my tutorial
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