0

I need to use a session that set in system call after performing mass data generation. Is it possible to call a session that sets in system call? Am using the following code:

system_call.php

session_start(); 
$_SESSION['global_notification']= 'Message';

front_end.php

session_start(); 
echo $_SESSION['global_notification'];
Masivuye Cokile
  • 4,754
  • 3
  • 19
  • 34
  • Yes its possible. as long as u always use session start – Masivuye Cokile Oct 26 '17 at 11:42
  • Have you tried to see whether it was possible? It's quite easy to test, just add the above code in your own examples to your php files and test it. – Epodax Oct 26 '17 at 11:43
  • What is "system call" exactly? What's special about it? – deceze Oct 26 '17 at 11:43
  • could you please share how to use it.. – Soumya Sarasan Oct 26 '17 at 11:43
  • 1
    Depends on who calls what. Session id is stored in cookie or URL. If requests to both files are made by the same client, then yes, it's possible. Otherwise no, it would be different session. – Roman Hocke Oct 26 '17 at 11:44
  • i need to create a 10000 data that is processing in backend without lagging the frontend usage. I have tried this code only in my code. but this is not working.. – Soumya Sarasan Oct 26 '17 at 11:45
  • 1
    Possible duplicate of [How to use store and use session variables across pages?](https://stackoverflow.com/questions/5489365/how-to-use-store-and-use-session-variables-across-pages) – Ole Haugset Oct 26 '17 at 11:47
  • 1
    How are you calling/invoking/executing `system_call.php`? – deceze Oct 26 '17 at 11:49
  • system("php system_call.php > Code.txt", $output); – Soumya Sarasan Oct 26 '17 at 12:18
  • 1
    Then that PHP instance has nothing to do with an actively connected client or any network request at all, and hence cannot (easily) interact with sessions. You should reconsider how you're handling this in the first place; a proper background worker system should probably be used here instead of a cheap command line trick. – deceze Oct 26 '17 at 12:35

1 Answers1

2

you cannot call the session variable that set in system call. you can create a file and can get the data you saved or you want to call from session variable. like-> fwrite($file,"Added data") and you can read the file and display the result

IOT Team
  • 36
  • 2