I am trying to access some phpBB functions from my Laravel application, this concerns actions such as adding a user when registration occurs on my main site and autologins.
PhpBB is installed under /public/forums , and I updated .htaccess to allow it. I can access and use it just fine.
I have an assistant that was originally built for codeigniter but needs to transfer to the laravel world. I download it as an assistant, putting it in the application, loading it with
use App\Helpers\phpBBHelper;
and I get access to the functions as such
$ph = new phpBBHelper(); $ph->addPhpbb3User('dave','password','dave@dave.com');
At the top of my assistant I have this constructor
public function __construct() { // Set the variables scope global $phpbb_root_path, $phpEx, $cache, $user, $db, $config, $template, $table_prefix; define('IN_PHPBB', TRUE); define('FORUM_ROOT_PATH', 'forum/'); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : FORUM_ROOT_PATH; $phpEx = substr(strrchr(__FILE__, '.'), 1); // Include needed files include($phpbb_root_path . 'common.' . $phpEx); // Initialize phpBB user session $user->session_begin(); $auth->acl($user->data); $user->setup(); // Save user data into $_user variable $this->_user = $user; }
When I execute the code, I get a 500 server error
PHP Fatal error: Call to a member function getScriptName() on null in /home/ubuntu/workspace/public/forum/phpbb/session.php on line 50
which is this line
$script_name = $request->escape($symfony_request->getScriptName(), true);
I found a stack overflow message that exactly relates to my problem, but a resolution to this problem has never been posted
conflict between laravel
In this thread, it has been suggested that since both phpBB and Laravel use a composer, it causes a conflict when loading classes. I am not sure if this is true.
But Laravel certainly affects phpBB when I call $user->session_begin(); .