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 4550904
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:33:41+00:00 2026-05-21T16:33:41+00:00

I right now have a comet page, that if i call session_start at the

  • 0

I right now have a comet page, that if i call session_start at the top then the session freezes, my work-around that do is this:

function getTables($sessionID = null){

        if(!isset($this->output)){
            $this->output = array();
        }

        if(!isset($this->output[$this->sessID])){
            $this->output[$this->sessID] = array();
        }
        $hostname = php_uname("n");

        $sess_ini = session_save_path();
        chdir($sess_ini);
        if(false === ($save = @file_get_contents("sess_$this->sessID"))){
            $cwd = getcwd();
            chdir($this->location);
            return (isset($this->returnJSON[$this->sessID])?$this->returnJSON[$this->sessID]
                    :json_encode(array(
                        'sess_local'=>"$sess_ini/sess_$this->sessID",
                        'save'=>$save,
                        'hostname'=>$hostname,
                        'cwd'=>$cwd,
                        'reg_local'=>$this->location,
                        )
                    )
                );
        }
        chdir($this->location);
        //session_id($sessionID);
        $sessions = explode("|",$save);
        $_SESSION['all'] = array();
        foreach($sessions as $key=>$sess){
            if(trim($sess)=='all' && isset($sessions[$key+1])){
                $_SESSION['all'] = unserialize(trim(urldecode($sessions[$key+1])));
                break;
            }
        }
        ...

Is there a better way for me to be getting the session vars thats not going into the session files?

  • 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-05-21T16:33:42+00:00Added an answer on May 21, 2026 at 4:33 pm

    Your work around can be much simpler:

     <?php
     //yes, start normally.
     session_start();
    
     //now, immediately harvest the variables you need to remember from the $_SESSION
     $somevar_you_want_to_remember = $_SESSION['somevar'];
    
     //close the session, so it won't lock:
     session_write_close();
    
     //disable some errors which aren't really errors:
     ini_set('session.use_cookies',false);
     session_cache_limiter(false);
    
     //you are now free to do anything you like:
     while(true){
    
         echo "<script>window.parent.test_function('".time().' sessionvar: '.$somevar_you_want_to_remember."');</script>";
    
         flush_buffers();
         sleep(1);
         //if you need to refresh your variable, you can just reopen the session:
         session_start();
         $somevar_you_want_to_remember = $_SESSION['somevar'];
         //and immediately close again
         session_write_close();         
    }
    

    You could write some helper functions, like:

     function SaveQuickSessionVar($name,$value){
          session_start();
          $_SESSION[$name] = $value;
         session_write_close();     
     }
    
     function GetQuickSessionVar($name){
         session_start();
         $var = $_SESSION[$name];
         session_write_close(); 
         return $var;    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have something like this in NHibernate: Expression.Like(property, value, MatchMode.Anywhere) and that
I have this php page that posts to itself and then it checks weather
Right now I have this SQL query which is valid but always times out:
Right now I have double numba = 5212.6312 String.Format({0:C}, Convert.ToInt32(numba) ) This will give
Right now i have a line of code, in vb, that calls a text
So, I have a page that looks like the following: alt text http://img704.imageshack.us/img704/5973/croppercapture3.png This
I have come across quite a wired problem right now. I am using ASP.NET
Good day! I right now have a function the drags an element from a
Right now I have def min(array,starting,ending) minimum = starting for i in starting+1 ..ending
Right now we have AD/Exchange to manage all of our users logins/e-mail on-site at

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.