Codeigniter-phpBB集成

时间:2012-11-06 05:48:01

标签: codeigniter phpbb phpbb3

我试图在Codeigniter项目中集成phpBB论坛。我已将codeigniter(phpbb library)提供的库放在projectName / application / libraries中,并将论坛放在项目的根目录下。控制器如下所示:

<?php
class Library_test extends CI_Controller
{
    function __construct()
    {
        parent::__construct();

        $this->load->database();
        $this->load->library('session');
        $this->load->library('phpbb_library');
    }

    function index()
    {
        if ($this->phpbb_library->isLoggedIn() === TRUE)
        {
            $userId = $this->phpbb_library->getUserInfo('user_id');
            $username = $this->phpbb_library->getUserInfo('username');

            echo "Welcome $username (" . ($this->phpbb_library->isAdministrator() === TRUE ? "administrator" : "user") . "), your ID is $userId and you are member of the following groups";

            foreach ($this->phpbb_library->getUserGroupMembership() as $group)
            {
                echo "$group <br />";
            }
        }
        else
        {
            echo "You are not logged-in.";
        }
    }
}
?>

我已为整个项目(chmod -R 777项目/)设置了适当的权限,并且错误显示为“未找到”的文件存在且可访问。请帮帮我。

以下是我尝试访问控制器时的错误。

遇到PHP错误

严重性:警告

消息:include(localhost / communityCI / community / common.php):无法打开流:没有这样的文件或目录

文件名:libraries / phpbb.php

行号:32

遇到PHP错误

严重性:警告

消息:include():无法打开'localhost / communityCI / community / common.php'(include_path ='。:/ usr / share / php:/ usr / share / pear')

文件名:libraries / phpbb.php

行号:32

遇到PHP错误

严重性:警告

消息:include(localhost / communityCI / community / config.php):无法打开流:没有这样的文件或目录

文件名:libraries / phpbb.php

行号:33

遇到PHP错误

严重性:警告

消息:include():无法打开'localhost / communityCI / community / config.php'(include_path ='。:/ usr / share / php:/ usr / share / pear')

文件名:libraries / phpbb.php

行号:33

遇到PHP错误

严重性:警告

消息:include(localhost / communityCI / community / includes / functions_user.php):无法打开流:没有这样的文件或目录

文件名:libraries / phpbb.php

行号:34

遇到PHP错误

严重性:警告

消息:include():无法打开'localhost / communityCI / community / includes / functions_user.php'(include_path ='。:/ usr / share / php:/ usr / share / pear')

文件名:libraries / phpbb.php

行号:34

遇到PHP错误

严重性:警告

消息:include(localhost / communityCI / community / includes / functions_display.php):无法打开流:没有这样的文件或目录

文件名:libraries / phpbb.php

行号:35

遇到PHP错误

严重性:警告

消息:include():无法打开'localhost / communityCI / community / includes / functions_display.php'(include_path ='。:/ usr / share / php:/ usr / share / pear')

文件名:libraries / phpbb.php

行号:35

遇到PHP错误

严重性:警告

消息:include(localhost / communityCI / community / includes / functions_privmsgs.php):无法打开流:没有这样的文件或目录

文件名:libraries / phpbb.php

行号:36

遇到PHP错误

严重性:警告

消息:include():无法打开'localhost / communityCI / community / includes / functions_privmsgs.php'(include_path ='。:/ usr / share / php:/ usr / share / pear')

文件名:libraries / phpbb.php

行号:36

遇到PHP错误

严重性:警告

消息:include(localhost / communityCI / community / includes / functions_posting.php):无法打开流:没有这样的文件或目录

文件名:libraries / phpbb.php

行号:37

遇到PHP错误

严重性:警告

消息:include():无法打开'localhost / communityCI / community / includes / functions_posting.php'(include_path ='。:/ usr / share / php:/ usr / share / pear')

文件名:libraries / phpbb.php

行号:37

致命错误:在第39行的/var/www/communityCI/application/libraries/phpbb.php中的非对象上调用成员函数session_begin()

1 个答案:

答案 0 :(得分:1)

  

包括(本地主机/ communityCI /小区/的common.php)

     

/var/www/communityCI/application/libraries/phpbb.php

您不应该从网址include;它很可能不会起作用(就像你在这里看到的那样)而且不是很好的做法。

使用文件的相对路径或绝对路径执行include

include('/var/www/communityCI/community/common.php');

你也不应该chmod 0777整个项目......