I am trying to access some of the functions within phpBB from my Laravel application, this is for actions such as adding a user when a registration happens on my main site and autologins.
PhpBB is installed under /public/forums
and I have updated .htaccess
to allow it. I am able to access and use it just fine.
I have a helper that was originally constructed for codeigniter but should translate in to the laravel world. I am loading it as a helper by putting it under app, loading it using
use App\Helpers\phpBBHelper;
and I access the functions as such
$ph = new phpBBHelper();
$ph->addPhpbb3User('dave','password','[email protected]');
At the top of my helper 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 server 500 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 have found a post on stack overflow that exactly refers to my issue but the resolution of that issue was never posted
In that thread it was suggested that because both phpBB and Laravel both use composer it was causing a conflict when loading the classes. I am not sure if that is true.
But Laravel is certainly affecting phpBB when I call the $user->session_begin();
.