Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:01:25+00:00 2026-06-17T05:01:25+00:00

i just did like this article to read session in nodejs and read sessions

  • 0

i just did like this article to read session in nodejs and read sessions data from memcached.but i had some problem to read data back from phpsessid.when i node this index.js script

var app = require("http").createServer(handler),
    fs = require("fs"),
    memcache = require("memcache"),
    co = require("./cookie.js");

app.listen(7070);

//On client incomming, we send back index.html
function handler(req, res){
    fs.readFile(__dirname + "/index.html", function(err, data){
        if(err){
            res.writeHead(500);
            return res.end("Error loading index.html");
        }else{
            res.writeHead(200);
            res.end(data);
        }
    });


    //Using php session to retrieve important data from user
    var cookieManager = new co.cookie(req.headers.cookie);

    var client = new memcache.Client(11211, "localhost");
    client.connect();

    client.get("sessions/"+cookieManager.get("PHPSESSID"), function(error, result){
        console.log("error : "+error);
        if(typeof(error)==="undefined"){
            var session = JSON.parse(result);
        }
    });
}

and access this script console log show this error : undefined message.i want to access session data and need help in this.

thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:01:27+00:00Added an answer on June 17, 2026 at 5:01 am

    No need to put connect for such a easy system. And btw this cookie manager is in production at many companies without any bug reported. So the problem does not come from that part.

    Try to check thoose :

    1) Check the php.ini file to find what is the session’s cookie name (by default it is PHPSESSID, but it can be changed)

    2) Check memcache is running, got everything fine (not locked by firewall or something). For that, on php or node.js side (choose one) : put a var into memcache then retrieve it and check the var content is the good one…

    3) Check memcacheSessionHandler on PHP Side is correctly used (before everything you need to have it running)

    3) If you still have problem, on cookie manager you will find a list function : print the content of it to check which cookie Node.JS Recieve.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just did a syntax like this mysql_real_escape_string($var = 'Hello'); print_r($var); and I got
I read this article: The two are very different from each other, although they
Just read this interesting article by Omar on his blog Linq to SQL solve
Yestereday I read a little about threading in ruby (like this article ), and
I did something similar to: http://tympanus.net/codrops/2012/01/04/thumbnail-proximity-effect/ and just like the original it works in
I just did an svn merge from a branch to a trunk in my
Apologies if I I just did not figure out the actual approach but I
I have read a couple of articles but im still having trouble understanding this.
I've read this article http://docs.python.org/2/tutorial/errors.html two times to make sure. It avoids the topic
i use a php class to make tag cloud from article, but i want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.