Hi all!
My environment is the following:
OS: WinXP pro sp3
PHP: 5.2.17
Apache: 2.2.19 (Win32)
Yii Framework: 1.1.8
MySQL: 5.1 on port 3307
database: anamnesi (uses latin1 charset).
For the first time I installed Yii and created a skeleton with yiic in a separate folder.
I have a small, populated, database named "anamnesi" with dimensional tables named "an_…".
I specified the following connection in protected/config/main.php:
'db'=>array(
'connectionString' => 'mysql:host=127.0.0.1;port=3307;dbname=anamnesi',
'emulatePrepare' => true,
'username' => 'yii',
'password' => 'yii',
'charset' => 'latin1',
'tablePrefix' => 'an_',
),
I login to Gii module but as soon as I click "Model Generator" I get the following PHP error:
PHP Error
include(PDO.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
C:\host\yii-1.1.8.r3324\framework\YiiBase.php(421)
409 {
410 foreach(self::$_includePaths as $path)
411 {
412 $classFile=$path.DIRECTORY_SEPARATOR.$className.'.php';
413 if(is_file($classFile))
414 {
415 include($classFile);
416 break;
417 }
418 }
419 }
420 else
421 include($className.'.php');
422 }
423 else // class name with namespace in PHP 5.3
424 {
425 $namespace=str_replace('\\','.',ltrim($className,'\\'));
426 if(($path=self::getPathOfAlias($namespace))!==false)
427 include($path.'.php');
428 else
429 return false;
430 }
431 return class_exists($className,false) || interface_exists($className,false);
432 }
433 return true;
Stack Trace
#0
+ C:\host\yii-1.1.8.r3324\framework\YiiBase.php(421): YiiBase::autoload()
#1
unknown(0): YiiBase::autoload("PDO")
#2
+ C:\host\yii-1.1.8.r3324\framework\db\CDbConnection.php(404): spl_autoload_call("PDO")
#3
+ C:\host\yii-1.1.8.r3324\framework\db\CDbConnection.php(356): CDbConnection->createPdoInstance()
#4
+ C:\host\yii-1.1.8.r3324\framework\db\CDbConnection.php(313): CDbConnection->open()
#5
+ C:\host\yii-1.1.8.r3324\framework\db\CDbConnection.php(291): CDbConnection->setActive(true)
#6
+ C:\host\yii-1.1.8.r3324\framework\base\CModule.php(372): CDbConnection->init()
#7
+ C:\host\yii-1.1.8.r3324\framework\base\CModule.php(86): CModule->getComponent("db")
#8
+ C:\host\yii-1.1.8.r3324\framework\gii\generators\model\ModelCode.php(54): CModule->__get("db")
#9
+ C:\host\yii-1.1.8.r3324\framework\web\CFormModel.php(40): ModelCode->init()
#10
+ C:\host\yii-1.1.8.r3324\framework\gii\CCodeGenerator.php(149): CFormModel->__construct()
#11
+ C:\host\yii-1.1.8.r3324\framework\gii\CCodeGenerator.php(61): CCodeGenerator->prepare()
#12
+ C:\host\yii-1.1.8.r3324\framework\web\actions\CInlineAction.php(50): CCodeGenerator->actionIndex()
#13
+ C:\host\yii-1.1.8.r3324\framework\web\CController.php(300): CInlineAction->runWithParams(array("r" => "gii/model"))
#14
+ C:\host\yii-1.1.8.r3324\framework\web\CController.php(278): CController->runAction(CInlineAction)
#15
+ C:\host\yii-1.1.8.r3324\framework\web\CController.php(257): CController->runActionWithFilters(CInlineAction, array())
#16
+ C:\host\yii-1.1.8.r3324\framework\web\CWebApplication.php(277): CController->run("")
#17
+ C:\host\yii-1.1.8.r3324\framework\web\CWebApplication.php(136): CWebApplication->runController("gii/model")
#18
+ C:\host\yii-1.1.8.r3324\framework\base\CApplication.php(158): CWebApplication->processRequest()
#19
– C:\host\anamnesi\index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2011-08-31 16:32:15 Apache/2.2.19 (Win32) PHP/5.2.17 Yii Framework/1.1.8
How can I test the database connection specified in main.php? (all parameters seems to me corrected).
What else can I test?
Thanks!