jarmand
(Jim Armand)
November 20, 2009, 5:47pm
1
Hi all.
I have read the tutorial to make a first application. But this probleme drives me crazy!!!
When i try to make the model in the yiic shell (model User user), the shell just exit with no error messages?!?!? Here’a the main.php
return array(
......
'components'=>array(
......
'db'=>array(
'class'=>'CDbConnection',
'connectionString'=>'mysql:host=localhost;dbname=yii',
'username' => 'root',
'password' => '',
),
......
);
And when i check for the yii requirements, PDO extension and PDO MySQL extension passed
Please anyone, help me
jayrulez
(Waprave)
November 20, 2009, 10:27pm
2
jarmand:
Hi all.
I have read the tutorial to make a first application. But this probleme drives me crazy!!!
When i try to make the model in the yiic shell (model User user), the shell just exit with no error messages?!?!? Here’a the main.php
return array(
......
'components'=>array(
......
'db'=>array(
'class'=>'CDbConnection',
'connectionString'=>'mysql:host=localhost;dbname=yii',
'username' => 'root',
'password' => '',
),
......
);
And when i check for the yii requirements, PDO extension and PDO MySQL extension passed
Please anyone, help me
the command is model <modelName> eg: model User or model user, not model User user
jarmand
(Jim Armand)
November 20, 2009, 11:34pm
3
Thanks for the reply. But that does not work. I tried it… Any ideas?
mbi
(mbi)
November 21, 2009, 12:42am
4
when you create the webapp with yiic, you are in the framework folder, right?
when you enter the yiic shell, you are in the protected folder of your app
after altering the config, restart your console
yiic shell ../index.php
>>model User
>>crud User
this normally works
jarmand
(Jim Armand)
November 21, 2009, 1:38am
5
mbi:
when you create the webapp with yiic, you are in the framework folder, right?
when you enter the yiic shell, you are in the protected folder of your app
after altering the config, restart your console
yiic shell ../index.php
>>model User
>>crud User
this normally works
Yes. I follow these steps:
– intalled the yii framework in my htdoc directory
– under the framework folder create the webapp
– go under the protected folder of my new webapp and do yiic shell …/index.php
– The user table is already in my sql database
– model user: The program exits with no error messages…???
*** I tried after dropping the user table and it works with a warning… But the purpose would be that it works with the table already created!!!
jarmand:
Hi all.
I have read the tutorial to make a first application. But this probleme drives me crazy!!!
When i try to make the model in the yiic shell (model User user), the shell just exit with no error messages?!?!? Here’a the main.php
return array(
......
'components'=>array(
......
'db'=>array(
'class'=>'CDbConnection',
'connectionString'=>'mysql:host=localhost;dbname=yii',
'username' => 'root',
'password' => '',
),
......
);
And when i check for the yii requirements, PDO extension and PDO MySQL extension passed
Please anyone, help me
Try changing your database host from ‘localhost’ to ‘127.0.0.1’. I know the default for the new versions of mysql is to try to connect through the local socket file rather than actually making a database connection when you use the host ‘localhost’.
I ran into a lot of errors with connecting to the database because of this. More a matter of database configuration, but using 127.0.0.1 allows you to still connect to localhost without changing your mysql conf.
If you still can’t get it to work, I recommend manually debugging the Model cli command to see where it is terminating and if it is getting to the point where it is executing the command.
You would want to debug this file: yii/framework/commands/shell/ModelCommand.php, function: run(), line: 236
Just add ‘die(“Got to here”);’ command in it until you find a point where it’s not getting to. From there, we can probably figure out more what is going wrong with it.
George
(Gngnevis)
November 22, 2009, 6:16pm
7
Just a guess, however I would try creating my app OUTSIDE the framework directory.
jarmand
(Jim Armand)
November 23, 2009, 1:36pm
8
killermonk:
Try changing your database host from ‘localhost’ to ‘127.0.0.1’. I know the default for the new versions of mysql is to try to connect through the local socket file rather than actually making a database connection when you use the host ‘localhost’.
I ran into a lot of errors with connecting to the database because of this. More a matter of database configuration, but using 127.0.0.1 allows you to still connect to localhost without changing your mysql conf.
If you still can’t get it to work, I recommend manually debugging the Model cli command to see where it is terminating and if it is getting to the point where it is executing the command.
You would want to debug this file: yii/framework/commands/shell/ModelCommand.php, function: run(), line: 236
Just add ‘die(“Got to here”);’ command in it until you find a point where it’s not getting to. From there, we can probably figure out more what is going wrong with it.
I’m getting to line 246
...
if(($db=Yii::app()->getDb())===null)
...
It’s like nothing is coming from the Yii::app()->getDb(). The die does not work after the if block. And still not work in the first line block…
jarmand
(Jim Armand)
November 23, 2009, 1:39pm
9
Thanks but does not work either
George
(Gngnevis)
November 23, 2009, 11:43pm
10
I am not sure of your environment, but for me to get it to work (Windows XP/WAMP) I had to alter the shell script:
if "%PHP_COMMAND%" == "" set PHP_COMMAND=C:/wamp/bin/php/php5.2.9-2/php.exe
jarmand
(Jim Armand)
December 1, 2009, 3:29am
11
If that can help… My problem was that i had easyphp and xampp intalled on my system: I tried to install in xampp while using easyphp’s php.exe. Changing the php.exe path in the environment solve the problem.
Thank you to those who tried to help me
kylian
(Yvan Sanchez)
December 8, 2009, 2:47pm
12
I had got exactly the same error. I tried all the recommendations in this post without success. Finally, after at least 2 hours debugging I found the problem:
In order to fill my needs I enabled the ‘accessControl’ filter in the SiteController.php file. Disabling the filter solved the problem.
mikl
(Mike)
December 9, 2009, 11:33am
13
You can also start yiic and specify the path to your main.php instead of index.php. Then you don’t have to change the accesscontrol each time you want to start the shell.