Node.js variable into php session variables

Problem

I would like to store a variable in php session using node.js.

Then load the php session back to node.js.

Is this possible?

Problem courtesy of: Jenan

Solution

You can do that, but like @Xeon06 said in his comment it's not easy. The best way to do that is to have the sessions in a database (which you should already have, not in cookies since cookies are small and not as safe as storing the data in the db).

Another thing you'll absolutely need is to know how to decode the cookie variable to obtain the user's session id. That depends on what framework you're using probably (CodeIgniter, CakePHP etc).

Solution courtesy of: alessioalex

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.