-1

I want to access php session in nodejs

I searched online and found Read PHP Session data in node.js

and used the sample code from https://www.npmjs.com/package/groan

but it shows the following error:

Error: ENOENT: no such file or directory, open '/tmpsess_1234567890abcdef'

Sugumar Venkatesan
  • 4,019
  • 8
  • 46
  • 77
  • Do you have a valid session named `/tmpsess_1234567890abcdef` and running in your `PHP` server? – David R Jul 04 '17 at 10:05
  • After looking at `groan`'s github page, I could understand you've used the same session provided there in the example, (CharlieBrown also pointed it out). Try replacing a `real` existing session with the one that you're trying now. – David R Jul 04 '17 at 10:07
  • @David R yes, I used same temp file name because I don't know how to get the php session file name.. please tell me how to get it. – Sugumar Venkatesan Jul 04 '17 at 10:09
  • I hope you will having the session mechanism in your site, and you would be having `session_start();` somewhere in your code, check for that, and output it using `echo session_id();` you'll be able to receive it – David R Jul 04 '17 at 10:11

1 Answers1

0

That's because you pasted the SAMPLE code from the repo. You should probably get that ID (the 1234567890abcdef) from the client cookie where PHP stores the session, and then use that to verify that the file exists and use the parser to retrieve the object.

CharlieBrown
  • 4,143
  • 23
  • 24