I am using a tracking pixel in my project, firing this pixel will make a request to the server which will run a PHP script. At the PHP script I need to store a value to be always available for that script and for every call, So I am trying to use session but it seems like always NOT-Set!
session_start();
require_once("../../abc.php");
// Allow requests from different domains
header('Access-Control-Allow-Origin: *');
if(isset($_SESSION['log_file']) && !empty($_SESSION['log_file'])) {
//Never goes here
} else {
//Always goes here
}
Any Idea why the session is always Not-set? and what is the best session's alternative in this case?
Thanks.
The reason was that Empty session created on every http request. Also apc(u) facing the same problem. see the links: