我已经使用yiic命令行实用程序在我的Ubuntu机器上成功安装并配置了YII。
我已经用过这个命令了。
YiiRoot/framework/yiic webapp myapplication
但是当我尝试在共享服务器上运行应用程序时,它没有获得库文件。
当你在Ubuntu上工作时,我假设你的灯在/opt文件夹下。
执行命令YiiRoot/framework/yiic webapp myapplication后,文件夹结构将显示为
opt
|
|
-- lampp
| |
| |
| --- htdocs
| | |
| | |
| | ---------Yii
| | |
| | ---------myapplication
这里,当你运行应用程序"myapplication"时,基类"YiiBase"将从Yii文件夹(Yii core)调用,这是在你的项目之外。
当你要让你的应用程序运行时,不要忘记上传两个文件夹,例如,你需要上传"Yii"answers"myapplication"文件夹。
为了更好的实践,将Yii文件夹保留在myapplication文件夹中,并更改索引页。通常index.php页面像下面这样, <?php
// change the following paths if necessary
$yii=dirname(__FILE__).'/../yii/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();
改变这一行
$yii=dirname(__FILE__).'/../yii/framework/yii.php';
$yii=dirname(__FILE__).'/yii/framework/yii.php';
在本地主机上执行此操作,并上传相同的应用程序。