First Application Problem.

hi , I am just yesterday try to use Yii Framework.

Setup: Win xp 64bit

virtual host name: http://127.0.0.1/Yii…root/testdrive/

webroot: c:/Progam Files/EasyPhp2.0b1/www/Yii1.0.1/framework/Webroot/testdrive

framework installed at c:/Framework/Webroot/www/Yii1.0.1/framework/

I have created the application using the yiic tool.

I have created product table using phpmyAdmin.

modified the /protected/config/main.php like this:

<?php





// uncomment the following to define a path alias


// Yii::setPathOfAlias('local','path/to/local-folder');





// This is the main Web application configuration. Any writable


// CWebApplication properties can be configured here.


return array(


	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',


	'name'=>'My Web Application',





	// preloading 'log' component


	'preload'=>array('log'),





	// autoloading model and component classes


	'import'=>array(


		'application.models.*',


		'application.components.*',


	),





	// application components


	'components'=>array(


		'log'=>array(


			'class'=>'CLogRouter',


			'routes'=>array(


				array(


					'class'=>'CFileLogRoute',


					'levels'=>'error, warning',


				),


			),


		),


		'user'=>array(


			// enable cookie-based authentication


			'allowAutoLogin'=>true,


		),


		// uncomment the following to set up database





		'db'=>array(


		 'connectionString'=>'mysql:host=localhost ;dbname=sale',


			  'username'=>'root',


              'password'=>'',


		),





	),





	// application-level parameters that can be accessed


	// using Yii::app()->params['paramName']


	'params'=>array(


		// this is used in contact page


		'adminEmail'=>'webmaster@example.com',


	),


);


Then I go to command Prompt and type this command:

C:\Program Files\EasyPHP 2.0b1\www\Yii1.0.1\framework>yiic shell WebRoot/testdrive/index.php

When I issue the 'model Product product' command I get this error:

YiiBase::include PDO.php : failed to open stream : No such file or directory.

Source file:

C:\Program Files\EasyPHP 2.0b1\www\Yii1.0.1\framework\YiiBase.php (292)

Any hint ?

Please Help me. Thanks in advance

Please run requirement checker to make sure you have PDO and PDO MySQL extensions installed.

Yes, Requirment checker shows PDO mysql extension is enabled.

I give you full error which i get  when i insert above coomand:



C:Program FilesEasyPHP 2.0b1wwwYii1.0.1framework>yiic shell WebRoot/testdrive/index.php


Yii Interactive Tool v1.0


Please type 'help' for help. Type 'exit' to quit.


>> model user


<!DOCTYPE html PUBLIC


        "-//W3C//DTD XHTML 1.0 Transitional//EN"


        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>


<title>


PHP Error</title>


<style type="text/css">


/*<![CDATA[*/


body {font-family:"Verdana";font-weight:normal;color:black;background-color:whit


e;}


h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }


h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }


h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}


p {font-family:"Verdana";font-size:9pt;}


pre {font-family:"Lucida Console";font-size:10pt;}


.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}


.message {color: maroon;}


.source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffe


e;}


.error {background-color: #ffeeee;}


/*]]>*/


</style>


</head>





<body>


<h1>PHP Error</h1>





<h3>Description</h3>


<p class="message">


YiiBase::include(PDO.php): failed to open stream: No such file or directory</p>





<h3>Source File</h3>


<p>


C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkYiiBase.php(292)</p>





<div class="source">


<pre>


00280:      * Class autoload loader.


00281:      * This method is provided to be invoked within an __autoload() magic


 method.


00282:      * @param string class name


00283:      */


00284:     public static function autoload($className)


00285:     {


00286:         // use include so that the error PHP file may appear


00287:         if(isset(self::$_coreClasses[$className]))


00288:             include(YII_PATH.self::$_coreClasses[$className]);


00289:         else if(isset(self::$_classes[$className]))


00290:             include(self::$_classes[$className]);


00291:         else


<div class="error">00292:             include($className.&#039;.php&#039;);


</div>00293:     }


00294:


00295:     /**


00296:      * Writes a trace message.


00297:      * This method will only log a message when the application is in deb


ug mode.


00298:      * @param string message to be logged


00299:      * @param string category of the message


00300:      * @see log


00301:      */


00302:     public static function trace($msg,$category=&#039;application&#039;)


00303:     {


00304:         if(YII_DEBUG)


</pre>


</div><!-- end of source -->





<h3>Stack Trace</h3>


<div class="callstack">


<pre>


#0 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkYiiBase.php(292): autol


oad()


#1 unknown(0): autoload()


#2 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkdbCDbConnection.php(22


6): spl_autoload_call()


#3 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkdbCDbConnection.php(20


8): CDbConnection-&gt;open()


#4 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkdbCDbConnection.php(18


7): CDbConnection-&gt;setActive()


#5 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkbaseCApplication.php(7


26): CDbConnection-&gt;init()


#6 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkbaseCApplication.php(3


77): CWebApplication-&gt;getComponent()


#7 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkclicommandsshellMode


lCommand.php(92): CWebApplication-&gt;getDb()


#8 unknown(0): ModelCommand-&gt;generateModel()


#9 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkconsoleCConsoleCommand


.php(116): call_user_func()


#10 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkclicommandsshellMod


elCommand.php(72): ModelCommand-&gt;copyFiles()


#11 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkclicommandsShellComm


and.php(99): ModelCommand-&gt;run()


#12 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkclicommandsShellComm


and.php(79): ShellCommand-&gt;runShell()


#13 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkconsoleCConsoleComman


dRunner.php(62): ShellCommand-&gt;run()


#14 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkconsoleCConsoleApplic


ation.php(88): CConsoleCommandRunner-&gt;run()


#15 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkbaseCApplication.php(


162): CConsoleApplication-&gt;processRequest()


#16 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkyiic.php(30): CConsole


Application-&gt;run()


#17 C:Program FilesEasyPHP 2.0b1wwwYii1.0.1frameworkyiic(15): require_once


()


</pre>


</div><!-- end of callstack -->





<div class="version">


2009-01-05 12:18:39 <a href="http://www.yiiframework.com/">Yii Framework</a>/1.0


.1</div>


</body>


</html>


Is there anything with entry script ?

Or database connection?

Please Help me.

Thanks for replying

Alsp please make sure the command line PHP parser is correct (in some environments, it could be different from the PHP parser used online).

Yes i check my php parser from command line it shows php 5.2.0

And phpinfo page also showing the same version.

Your command line PHP parser needs to use the correct php.ini (you can write a simple phpinfo() script and run it in command line to verify this).

I run the script from coomand line and it runs .

It shows same thing as phpinfo page.

Be sure the path 'WebRoot/testdrive/index.php' is the destination of YOU wwwroot or htdocs!

I dont understand Properly

That's weird. Are you sure you have both pdo and pdo_mysql extensions enabled? The error message indicates that you don't have pdo.

From:

c:/Progam Files/EasyPhp2.0b1/www/Yii1.0.1/framework/Webroot/testdrive

try to launch yiic that way:

protected/yiic shell

bye,

Giovanni.

hii  i am not feeling well  yesterday thats why i can't answer u.

But I try both of your ways.

But I find in my phpinfo page is this :

          pdo_pgsql

PDO Driver for PostgreSQL enabled

PostgreSQL(libpq) Version 8.1.4

Module version 1.0.2

Revision $Id: pdo_pgsql.c,v 1.7.2.11 2006/03/14 10:49:18 edink Exp $

But For Mysql phpinfo show:

              pdo_mysql

PDO Driver for MySQL, client library version 5.0.22

Is it okey ?

Or something that i miss?

Please help me .

I am struck here.

I want to get out of this.

You also need 'pdo' extension, not only 'pdo_mysql'.

Hi all,

I have a similar problem (YiiBase::include(PDO.php): failed to open stream: No such file or directory).

Although i go to: http://localhost/yii_fr/requirements/ :

PDO extension          Passed  All DB-related classes

PDO MySQL extension  Passed  All DB-related classes

Please help.

Thanks,

Rnr

Quote

Your command line PHP parser needs to use the correct php.ini (you can write a simple phpinfo() script and run it in command line to verify this).

sorry if it is not the best solution.

but it's works to me.

try to copy “php.exe”, “php_pdo.dll”, “php_pdo_mysql”, and “php.ini” to “Yii\framework”.

then execute from Yii\framework: “c:…\framework>yiic shell c:…\project\index.php

hope it works to you too.

Quote

[...]Setup: Win xp 64bit[...]
Hi,

I’m running Vista 64bit. This OS creates two Program Files directories:

  • Program Files (x86)
  • Program Files
I remember a problem I had: PHP interpreter dislikes paths containing parantheses. Unfortunately, default PHP on Vista 64 installation path is "Program Files (x86)PHP". Then, when I tried to debug a PHP script I received strange error messages.

The easiest solution is to reinstall PHP into “Program Files”. (Uninstall from Program Files (x86)\PHP, install into Program Files\PHP.)

This cookbook page should help: http://www.yiiframew…doc/cookbook/3/