【问题标题】:"CAssetManager.basePath "/Applications/XAMPP/xamppfiles/htdocs/instastrm/assets" is invalid"CAssetManager.basePath "/Applications/XAMPP/xamppfiles/htdocs/instastrm/assets" 无效
【发布时间】:2015-12-05 01:04:33
【问题描述】:

我下载了this GitHub 项目。但是当我将它放入我的 XAMPP 并运行它时,一开始它会显示如下错误:

警告:require_once(/Applications/XAMPP/xamppfiles/htdocs/instastrm/../framework/yii.php):无法打开流:/Applications/XAMPP/xamppfiles/htdocs/instastrm/ 中没有这样的文件或目录第 13 行的 index.php

致命错误:require_once():需要打开失败 '/Applications/XAMPP/xamppfiles/htdocs/instastrm/../framework/yii.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') 在 /Applications/XAMPP/xamppfiles/htdocs/instastrm/index.php 在第 13 行

我通过下载yii framework 1.1.16 并将framework 文件夹放入应用程序的根目录并调整index.php 中的文件位置来修复它。上述错误消失了,但取而代之的是一个新错误,但由于我是 Yii 的新手,我不知道如何解决以下错误。

C异常

CAssetManager.basePath “/Applications/XAMPP/xamppfiles/htdocs/instastrm/assets”无效。 请确保该目录存在并且可被 Web 写入 服务器进程。

【问题讨论】:

  • 看看错误,它说明了一切Please make sure the directory exists and is writable by the Web server process。为assets 文件夹提供写权限,如果它不存在则创建一个。
  • @Criesto 源项目中不存在这样的文件夹。所以我创建了一个名为“/assets”的文件夹,但无济于事。我还将其权限设置为在 mac 上读写。我会错过哪里?将框架文件夹放入源项目真的有必要吗?这是正确的方法吗?
  • 不是必须的,但是您应该将框架文件夹移动到项目文件夹中并相应地更改index.php 文件。您还应该给/protected/runtime/application.log 写权限
  • @Criesto 你能在你的系统上试一试,让我知道如何真正让它工作吗?这对我(如果不是每个人)会有很大帮助吗?我在这里一次又一次地失败。
  • 非常适合我

标签: php apache yii


【解决方案1】:

here 下载您要安装的项目。 从here下载Yii 1.1.16

  • 解压/var/www文件夹中的项目文件夹,你的文件夹结构应该类似于/var/www/instastrm-master/,你可以根据需要重命名。
  • 现在,解压缩您之前下载的yii-1.1.16.bca042.tar.gz 并复制framework 文件夹并将其粘贴到/var/www/instastrm-master/ 中。
  • 修改您的 index.php 文件,您可以在 /var/www/instastrm-master/index.php 换行:

    $yii=dirname(__FILE__).'/../framework/yii.php';

    $yii=dirname(__FILE__).'/framework/yii.php';

  • /var/www/instastrm-master/内创建一个assets文件夹,并赋予整个文件夹读写权限(777)。

  • /var/www/instastrm-master/protected/ 中创建另一个名为runtime 的文件夹,并赋予它读写权限。
  • 尝试执行应用程序http://localhost/instastrm-master,它应该可以工作。

编辑:

Error 500 CDbConnection failed to open the DB connection.上查看你的cmets后,这个错误表示applcation无法连接到数据库,我不是很清楚你的项目细节,我在/protected/models/中查看了models,我猜你必须创建以下表格:

  1. media,带有字段id, name
  2. media_details 带有字段 id, tag_id, media_url, display_url, text, profile_image_url, username, media_id, media_type_id, unique_identifier
  3. media_type 带有字段 id, name
  4. tags 带有字段 id, name, unix_time

然后修改您的项目/protected/config/main.php 文件以连接到您的数据库,例如:

'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=<your_database_name>',
            'emulatePrepare' => true, 
            'username' => 'db_username',
            'password' => 'db_password',
            'charset' => 'utf8',
        ),

注意:根据需要更改db参数。

我建议您先阅读官方的yii 指南并了解yii 的工作原理,您也可以参考Larry Ullman yii series 逐步解释所有内容。

希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-17
    • 2014-09-30
    相关资源
    最近更新 更多