求助 window 下运行YII问题

D:\AppServ\www>php yii\yiic webapp testyii

Create a Web application under 'D:\AppServ\www\testyii'? [Yes|No] yes

  generate index.php

      mkdir D:/AppServ/www/testyii/protected

  generate protected/yiic

  generate protected/yiic.php

  generate protected/.htaccess

  generate protected/yiic.bat

      mkdir D:/AppServ/www/testyii/protected/commands

      mkdir D:/AppServ/www/testyii/protected/commands/shell

  generate protected/commands/shell/.yii

      mkdir D:/AppServ/www/testyii/protected/config

  generate protected/config/test.php

  generate protected/config/console.php

  generate protected/config/main.php

      mkdir D:/AppServ/www/testyii/protected/views

      mkdir D:/AppServ/www/testyii/protected/views/site

  generate protected/views/site/login.php

  generate protected/views/site/contact.php

  generate protected/views/site/index.php

      mkdir D:/AppServ/www/testyii/protected/views/layouts

  generate protected/views/layouts/main.php

      mkdir D:/AppServ/www/testyii/protected/views/system

  generate protected/views/system/.yii

      mkdir D:/AppServ/www/testyii/protected/controllers

  generate protected/controllers/SiteController.php

      mkdir D:/AppServ/www/testyii/protected/runtime

  generate protected/runtime/.yii

      mkdir D:/AppServ/www/testyii/protected/messages

  generate protected/messages/.yii

      mkdir D:/AppServ/www/testyii/protected/extensions

  generate protected/extensions/.yii

      mkdir D:/AppServ/www/testyii/protected/components

  generate protected/components/UserIdentity.php

  generate protected/components/MainMenu.php

      mkdir D:/AppServ/www/testyii/protected/components/views

  generate protected/components/views/mainMenu.php

      mkdir D:/AppServ/www/testyii/protected/tests

  generate protected/tests/bootstrap.php

  generate protected/tests/phpunit.xml

      mkdir D:/AppServ/www/testyii/protected/tests/functional

  generate protected/tests/functional/.yii

      mkdir D:/AppServ/www/testyii/protected/tests/fixtures

  generate protected/tests/fixtures/.yii

      mkdir D:/AppServ/www/testyii/protected/tests/unit

  generate protected/tests/unit/.yii

      mkdir D:/AppServ/www/testyii/protected/models

  generate protected/models/LoginForm.php

  generate protected/models/ContactForm.php

      mkdir D:/AppServ/www/testyii/assets

  generate assets/.yii

      mkdir D:/AppServ/www/testyii/themes

      mkdir D:/AppServ/www/testyii/themes/classic

      mkdir D:/AppServ/www/testyii/themes/classic/views

  generate themes/classic/views/.htaccess

      mkdir D:/AppServ/www/testyii/themes/classic/views/site

  generate themes/classic/views/site/.yii

      mkdir D:/AppServ/www/testyii/themes/classic/views/layouts

  generate themes/classic/views/layouts/.yii

      mkdir D:/AppServ/www/testyii/themes/classic/views/system

  generate themes/classic/views/system/.yii

      mkdir D:/AppServ/www/testyii/images

  generate images/.yii

      mkdir D:/AppServ/www/testyii/css

  generate css/bg.gif

  generate css/form.css

  generate css/main.css

Your application has been created successfully under D:\AppServ\www\testyii.

D:\AppServ\www>php yii\yiic shell testyii\index.php

Yii Interactive Tool v1.0 (based on Yii v1.1-dev)

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

>> model Blog

<!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>Internal Server 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-weight:normal;color:black;font-size:9pt;margin-top

: -5px}

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

/]]>/

</style>

</head>

<body>

<h1>Internal Server Error</h1>

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

/h2>

<p>

An internal error occurred while the Web server was processing your request.

Please contact the webmaster to report this problem.

</p>

<p>

Thank you.

</p>

<div class="version">

2009-06-20 01:45:58 </div>

</body>

</html>

D:\AppServ\www>

到运行MODEL 时,就出现问题

我的系统是XP2

PHP运行环境是appserv

我换个WAMP 都是一样的问题,如何解决些问题

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

我开了PDO

然后变成这样子

D:\AppServ\www>php yii\yiic shell testyii\index.php

Yii Interactive Tool v1.0 (based on Yii v1.1-dev)

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

>> model Blog

exception 'CDbException' with message 'CDbConnection failed to open the DB conne

ction: could not find driver' in D:\AppServ\www\yii\db\CDbConnection.php:248

Stack trace:

#0 D:\AppServ\www\yii\db\CDbConnection.php(223): CDbConnection->open()

#1 D:\AppServ\www\yii\db\CDbConnection.php(202): CDbConnection->setActive(true)

#2 D:\AppServ\www\yii\base\CModule.php(353): CDbConnection->init()

#3 D:\AppServ\www\yii\base\CApplication.php(338): CModule->getComponent('db')

#4 D:\AppServ\www\yii\cli\commands\shell\ModelCommand.php(267): CApplication->ge

tDb()

#5 D:\AppServ\www\yii\cli\commands\ShellCommand.php(136): ModelCommand->run(Arra

y)

#6 D:\AppServ\www\yii\cli\commands\ShellCommand.php(96): ShellCommand->runShell(

)

#7 D:\AppServ\www\yii\console\CConsoleCommandRunner.php(62): ShellCommand->run(A

rray)

#8 D:\AppServ\www\yii\console\CConsoleApplication.php(88): CConsoleCommandRunner

->run(Array)

#9 D:\AppServ\www\yii\base\CApplication.php(133): CConsoleApplication->processRe

quest()

#10 D:\AppServ\www\yii\yiic.php(31): CApplication->run()

#11 D:\AppServ\www\yii\yiic(15): require_once('D:\AppServ\www…')

#12 {main}

貌似没有建立Blog数据库吧?

还有,有没有在config目录下main.php中加上'db'=>array(…)?

Quote

貌似没有建立Blog数据库吧?

还有,有没有在config目录下main.php中加上'db'=>array(…)?

已经那建了..但不知道是什么问题

检查下php.ini,是不是加载了相应的dll

Quote

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

我也遇到过,很奇怪,关了命令行窗口,再打开,就行了

要不,重启电脑再试,就行了

是很奇怪,那位高手能提供个你们项目的详细配置步骤(window环境下的搭配)

这说明你的命令行PHP没有加载PDO扩展。

你可以用php -c path/to/php.ini framework/yiic.php 来显式地指定用某个php.ini。

Quote

这说明你的命令行PHP没有加载PDO扩展。

你可以用php -c path/to/php.ini framework/yiic.php 来显式地指定用某个php.ini。

D:\AppServ\www>php -c D:\AppServ\php5\to\php.ini yii/yiic.php shell testyii/inde

x.php

Yii Interactive Tool v1.0 (based on Yii v1.1-dev)

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

>> model Blog

<!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>Internal Server 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-weight:normal;color:black;font-size:9pt;margin-top

: -5px}

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

/]]>/

Quote

这说明你的命令行PHP没有加载PDO扩展。

你可以用php -c path/to/php.ini framework/yiic.php 来显式地指定用某个php.ini。

何解!

D:\AppServ\www>php -c C:/WINDOWS/php.ini yii/yiic.php shell testyii/index.php

Yii Interactive Tool v1.0 (based on Yii v1.1-dev)

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

>> model Blog

exception 'CDbException' with message 'CDbConnection failed to open the DB conne

ction: could not find driver' in D:\AppServ\www\yii\db\CDbConnection.php:248

Stack trace:

#0 D:\AppServ\www\yii\db\CDbConnection.php(223): CDbConnection->open()

#1 D:\AppServ\www\yii\db\CDbConnection.php(202): CDbConnection->setActive(true)

#2 D:\AppServ\www\yii\base\CModule.php(353): CDbConnection->init()

#3 D:\AppServ\www\yii\base\CApplication.php(338): CModule->getComponent('db')

#4 D:\AppServ\www\yii\cli\commands\shell\ModelCommand.php(267): CApplication->ge

tDb()

#5 D:\AppServ\www\yii\cli\commands\ShellCommand.php(136): ModelCommand->run(Arra

y)

#6 D:\AppServ\www\yii\cli\commands\ShellCommand.php(96): ShellCommand->runShell(

)

#7 D:\AppServ\www\yii\console\CConsoleCommandRunner.php(62): ShellCommand->run(A

rray)

#8 D:\AppServ\www\yii\console\CConsoleApplication.php(88): CConsoleCommandRunner

->run(Array)

#9 D:\AppServ\www\yii\base\CApplication.php(133): CConsoleApplication->processRe

quest()

#10 D:\AppServ\www\yii\yiic.php(31): CApplication->run()

#11 {main}

>>

除了PDO外,你还需要对应数据库所需的PDO驱动。

Quote

除了PDO外,你还需要对应数据库所需的PDO驱动。

非常感谢qiang

问题已解决.需要开启对应的PDO驱动

我的PHP.INI 里没有

extension=php_pdo_mysql.dll

所以自己添加

如果遇到同我同样问题的YIIer

请确认.你的phh.ini

有无开启PDO 和对应的数据库驱动.

例如你用mysql

;extension=php_pdo.dll

;extension=php_pdo_mysql.dll

去除";"

extension=php_pdo.dll

extension=php_pdo_mysql.dll