Search code examples
codeigniterphpbbphpbb3

Codeigniter-phpBB integration


I have tried to integrate phpBB forum in Codeigniter project. I have placed the library provided by codeigniter(phpbb library) inside the projectName/application/libraries and placed the forum at the root of the project. The controller looks like this:

<?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.";
        }
    }
}
?>

I have set appropriate permission for the whole project (chmod -R 777 project/) and the files that the error says as "not found" are there and accessible. Please help me out.

Following is the error when I try to access the controller.

A PHP Error was encountered

Severity: Warning

Message: include(localhost/communityCI/community/common.php): failed to open stream: No such file or directory

Filename: libraries/phpbb.php

Line Number: 32

A PHP Error was encountered

Severity: Warning

Message: include(): Failed opening 'localhost/communityCI/community/common.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

Filename: libraries/phpbb.php

Line Number: 32

A PHP Error was encountered

Severity: Warning

Message: include(localhost/communityCI/community/config.php): failed to open stream: No such file or directory

Filename: libraries/phpbb.php

Line Number: 33

A PHP Error was encountered

Severity: Warning

Message: include(): Failed opening 'localhost/communityCI/community/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

Filename: libraries/phpbb.php

Line Number: 33

A PHP Error was encountered

Severity: Warning

Message: include(localhost/communityCI/community/includes/functions_user.php): failed to open stream: No such file or directory

Filename: libraries/phpbb.php

Line Number: 34

A PHP Error was encountered

Severity: Warning

Message: include(): Failed opening 'localhost/communityCI/community/includes/functions_user.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

Filename: libraries/phpbb.php

Line Number: 34

A PHP Error was encountered

Severity: Warning

Message: include(localhost/communityCI/community/includes/functions_display.php): failed to open stream: No such file or directory

Filename: libraries/phpbb.php

Line Number: 35

A PHP Error was encountered

Severity: Warning

Message: include(): Failed opening 'localhost/communityCI/community/includes/functions_display.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

Filename: libraries/phpbb.php

Line Number: 35

A PHP Error was encountered

Severity: Warning

Message: include(localhost/communityCI/community/includes/functions_privmsgs.php): failed to open stream: No such file or directory

Filename: libraries/phpbb.php

Line Number: 36

A PHP Error was encountered

Severity: Warning

Message: include(): Failed opening 'localhost/communityCI/community/includes/functions_privmsgs.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

Filename: libraries/phpbb.php

Line Number: 36

A PHP Error was encountered

Severity: Warning

Message: include(localhost/communityCI/community/includes/functions_posting.php): failed to open stream: No such file or directory

Filename: libraries/phpbb.php

Line Number: 37

A PHP Error was encountered

Severity: Warning

Message: include(): Failed opening 'localhost/communityCI/community/includes/functions_posting.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

Filename: libraries/phpbb.php

Line Number: 37

Fatal error: Call to a member function session_begin() on a non-object in /var/www/communityCI/application/libraries/phpbb.php on line 39


Solution

  • include(localhost/communityCI/community/common.php)

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

    You shouldn't include from a URL; it most likely won't work (like you see here) and isn't good practice.

    Do your include's with a relative or absolute path to the file:

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

    You also shouldn't chmod 0777 the entire project...