use yii framework in xampp

Hi,guys.

I’m using yiiframework in xampp .There is something wrong as followings.

chal@chal-desktop:/opt/lampp/htdocs/blog$ sudo php -c /opt/lampp/etc/php.ini /opt/lampp/htdocs/yii/framework/yiic shell

Yii Interactive Tool v1.1 (based on Yii v1.1.1)

Please type ‘help’ for help. Type ‘exit’ to quit.

>> model User

Warning: PDO::__construct(): [2002] Invalid argument (trying to connect via unix://) in /opt/lampp/htdocs/yii/framework/db/CDbConnection.php on line 302

exception ‘CDbException’ with message ‘CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Invalid argument’ in /opt/lampp/htdocs/yii/framework/db/CDbConnection.php:267

Stack trace:

#0 /opt/lampp/htdocs/yii/framework/db/CDbConnection.php(242): CDbConnection->open()

#1 /opt/lampp/htdocs/yii/framework/db/CDbConnection.php(221): CDbConnection->setActive(true)

#2 /opt/lampp/htdocs/yii/framework/base/CModule.php(352): CDbConnection->init()

#3 /opt/lampp/htdocs/yii/framework/base/CApplication.php(391): CModule->getComponent(‘db’)

#4 /opt/lampp/htdocs/yii/framework/cli/commands/shell/ModelCommand.php(260): CApplication->getDb()

#5 /opt/lampp/htdocs/yii/framework/cli/commands/ShellCommand.php(144): ModelCommand->run(Array)

#6 /opt/lampp/htdocs/yii/framework/cli/commands/ShellCommand.php(99): ShellCommand->runShell()

#7 /opt/lampp/htdocs/yii/framework/console/CConsoleCommandRunner.php(62): ShellCommand->run(Array)

#8 /opt/lampp/htdocs/yii/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)

#9 /opt/lampp/htdocs/yii/framework/base/CApplication.php(135): CConsoleApplication->processRequest()

#10 /opt/lampp/htdocs/yii/framework/yiic.php(33): CApplication->run()

#11 /opt/lampp/htdocs/yii/framework/yiic(15): require_once(’/opt/lampp/htdo…’)

#12 {main}

Seems to be a problem related with your sql server (mysql?).

Can you connect to mysql with command line or something?

Thank you ! I have solved it

      'db'=>array(


                    'connectionString' => [i]'mysql:host=127.0.0.1[/i];dbname=blog',


                    'emulatePrepare' => true,


                    'username' => 'root',


                    'password' => '',


                    'charset' => 'utf8',


            ),

It is wrong when ‘mysql:host=localhost’