I have a small problem with one of my projects. I am using two servers, one for the Frontend and the other for the Backend. The Frontend server is hosted on Netlify and the Backend is hosted on LocalWeb with a domain. I am using ReactJS and PHP technologies to carry out the project. In one part of the project the user needs to log in to access some resources, I implemented the session variables in PHP. In some Desktop browsers they work perfectly, but when opened on some Android and iOS cell phones the session variables are not sent in the response Header. I did a lot of research and made some configurations in PHP but it didn't work.
The project here is open in the Google Chrome browser where it is working perfectly. The variable responsible for storing the PHPSESSID Cookies is being created as expected. Print
Here the project is open in the Maxthon browser and there is a failure when storing session cookies. It has a warning alert and when you hover over it the following message appears: Setting this cookie was blocked due to third-part cookie phaseout. Learn more in the issues tab. Print
Here is my PHP configuration on LocalWeb hosting. The configuration is done through the user.ini file, similar to the php.ini file. The session_cookie_secure property is enabled because I use HTTPS on both servers and session_cookie_samesite is set to 'None' to allow communication between different domains.
Print
This is my PHP Class that manages sessions.
<?php
class Session {
public static function start_session(){
if(session_status() == PHP_SESSION_NONE){
/*ini_set("session.gc.maxlifetime", 10000);
session_set_cookie_params([
'lifetime' => 10000,
'path' => '/',
'domain' => 'exaltaicifra.br',
'secure' => true,
'httponly' => true,
//'samesite' => 'None'
]);*/
session_start();
//setcookie('ID_PHP_SESSION', session_id());
}
}
public static function setVariableSession($name, $value){
if(!empty($name)){
$_SESSION[$name] = $value;
}
}
public static function getVariableSession($name){
return isset($_SESSION[$name]) ? $_SESSION[$name] : "Null";
}
public static function regenerateID(){
session_regenerate_id();
//$this->start_session();
/*if (!isset($_SESSION['initialized'])){
session_regenerate_id();
$_SESSION['initialized'] = true;
} */
}
public static function destroySession(){
session_unset();
session_destroy();
}
}
Note: In the Maxthon browser and probably in Android and iOS browsers, the variable responsible for storing the "PHPSESSID" cookie changes value when reloading the page, while in Edge and Chrome this does not happen.
I implemented an implementation in the response that returns a status of Error or Success. In Edge and Chrome browsers, they return Success, and in this browser, Maxthon returns Error. The session variable is created, but it is as if it did not exist on the server.
Print
What could be causing this abnormality with Cookies?
I did a lot of research but didn't find much...