My legacy project has differents index.php. Depends on url, .htaccess redirects to another index.php in another folder, when i include autoloads and starts all again like is shown bellow.
paht: app.project.com/
index: ./index.php
include 'autoloads.php';
$session = new \Gears\Session();
$session->dbConfig = [
'driver' => dotenv('DB_CONNECTION'),
'host' => dotenv('DB_HOST'),
'database' => dotenv('DB_DATABASE'),
'username' => dotenv('DB_USERNAME'),
'password' => dotenv('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
];
$session->globalise();
when i do login, the project will redirectme to
paht: app.project.com/login
index: ./admin/main.php
include 'autoloads.php';
$session = new \Gears\Session();
$session->dbConfig = [
'driver' => dotenv('DB_CONNECTION'),
'host' => dotenv('DB_HOST'),
'database' => dotenv('DB_DATABASE'),
'username' => dotenv('DB_USERNAME'),
'password' => dotenv('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
];
$session->globalise();
The problem is that ever when it's called new \Gears\Session(), the session which i started in index.php is erased on main.php. If i do not call new \Gears\Session(), when i try to access Session::anything, an exception is thrown on screen saying: You need gobalize first. Is there any way to solve that?