Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird empty session issue

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
0
0
US
Ok - first I've confirmed sessions working with this test script:
Code:
<?php 
session_start(); 
if (!isset($_SESSION['counter'])) $_SESSION['counter']=0;
echo "Counter ".$_SESSION['counter']++." ???.<br><a href=".$_SERVER['PHP_SELF'].">reload</a>"; 
?>
However when I'm using my code it doesn't work in Chrome or Safari but does work in FireFox, IE8, and Opera.

At the end of my code I put:
Code:
        echo session_id(); echo '<pre>'; var_dump($_SESSION); echo '</pre>';
        session_write_close(); exit();
I am seeing the session data in the browser. At this point I go to the server and I can find the session file - but it is empty (though only when I'm using Safari or Chrome). Any ideas as to what might be causing it to not save the session data?

Thanks.
 
Another thing preventing us from going linux is MSSQL. I know it can be done, but that would requite a major rewrite of several websites hosted on our IIS machine. I wish I could use MySQL, but some of our software requires MSSQL.
 
why is that a problem?

surely you'd just point your db connection script at the mssql server? everything else stays the same.
 
You would have to google the extentons yourself. I seem to think that they are not suppored these day.
Expression web is mucho diferent from frontpage. I think you might have to review why you would need to do with the extentions.
Must admit I'm out of ideas about your issue. Session should work ok on windows, you don't seem to be generating a race condition.
I wonder if you have some kind of buffering issue i.e. the underyling file is not getting flushed correctly.
It's odd you should say you have had issues with session in a database as your also getting them with the file system.
As far as using DB in a MVC you just have to register the handlers so shoudn't be a real issue I would think.
 
@jpadie: The db connection script is using sqlsrv - Microsoft's supported PHP extension (which supports parameterized queries) - which won't work on Linux. Everything would need to be converted over to the mssql_ extension (no parameterized queries), which has different functions.

@ingresman: The session in the database issues where/are a code thing I believe when I investigated it. I think it had something to do with supporting page elements - like multiple dynamic images on the same page that were dependent on the user information (thus needing the session).
 
pdo supports parameterised queries too. there is an experimental mssql driver and an odbc driver.

but i suspect that this would be a headache !
 
I believe I have solved this issue.

After my application processes the 'saved_form' key - which it does on every run - it removes it for security reasons.

I am using a rewrite module for nicer links (module is IIRF).

This is where the problem was - though it is no fault of the module, just my rules.

After the page was rendered and the session saved - the browser made another request to favicon.ico, however the rules I setup caused that request to get run through my app and the form processed and removed from the session - thus causing the odd behavior I was seeing. I added a rule to ignore it, and it is working again.
 
thanks for posting back. interesting that the most obvious place to look is so often the last in line.
 
Thanks for the update, you would be suprised how many people don't share fixes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top