driver not found !

hello,

I run easyphp 5.3.0 and i get this error

exception ‘CDbException’ with message ‘CDbConnection failed to open the DB connection: could not find driver’ in C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\d

Stack trace:

#0 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\db\CDbConnection.php(230): CDbConnection->open()

#1 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\db\CDbConnection.php(209): CDbConnection->setActive(true)

#2 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\base\CModule.php(353): CDbConnection->init()

#3 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\base\CApplication.php(373): CModule->getComponent(‘db’)

#4 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\cli\commands\shell\ModelCommand.php(246): CApplication->getDb()

#5 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\cli\commands\ShellCommand.php(142): ModelCommand->run(Array)

#6 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\cli\commands\ShellCommand.php(99): ShellCommand->runShell()

#7 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\console\CConsoleCommandRunner.php(62): ShellCommand->run(Array)

#8 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\console\CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)

#9 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\base\CApplication.php(135): CConsoleApplication->processRequest()

#10 C:\Program Files\EasyPHP5.3.0\www\yii-1.0.10.r1472\framework\yiic.php(31): CApplication->run()

#11 C:\Program Files\EasyPHP5.3.0\www\testdrive\protected\yiic.php(7): require_once(‘C:\Program File…’)

#12 {main}

I use this commadn line:

php -c "C:\Program Files\EasyPHP5.3.0\conf_files\php.ini" protected\yiic.php shell

How did you configure your Yii database settings? And does phpinfo() show that the PDO drivers for your specific database type are enabled?

If not, check the php.net site on how to enable those drivers.

I am having the same problem. I have a xampp setup and use the following command to make sure that the correct php.ini file is being read.


php -c /Applications/xampp/etc/php.ini protected/yiic.php shell

I have pdo_mysql installed and it works fine as I use it in conjunction with other websites I am developping.

I reall wanted to test yii, and like to develop on the local machine, Therefore it is essential that I get it to play nice with xampp.

Is there someone out there who can help.

So I have the solution for anyone who has a xampp on mac setup. On a mac there is a default php4 version installed. In the terminal any php commands made in the terminal per default use this version, see thread

In the terminal do the following


>cd ~

>pico .profile

Replace


export PATH=/opt/local/bin:/opt/local/sbin:$PATH

with


export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH

exit edit mode with key combination ctrl x

save by typing y

reload the .profile file


>. ./.profile

Now whenever you do in yiic stuff, the correct php an mysql version will be used.