NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Proplems with PHP sessions


Joined: 15 Dec 2005
Posts: 3
Reply with quote
I ran into an issue with debugging and sessions. In order to do some trouble shooting and get things to work I had to use an external browser to debug. I am using Firefox 1.5 on Windows XP and PHP 5.1.1 (local server) latest DBG for 5.1.1. The problem also exists when using the built in browser in PhpEd 4.0.1 build 4048. Have not tried a previous version since I am just getting started with this IDE.

When starting a debug session in a clean browser (just loaded) the DBGSESSID cookie is created but the PHPSESSID is not. Therefore the session variables are not maintained across pages and I get a lot of variable not defined messages because of that. I am auto-starting the session in the PHP.INI file.

If on the other hand, if I open up the same site in the external browser first and then start the debug session all works fine including the session variable and all cookies are created as expected. Debugging then works like a charm.

If someone has any idea how to resolve this I would greatly appreciate it, since using an external browser Can be a pain fro debugging. Also this site works fine under normal circumstances.
View user's profileFind all posts by tmoseSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Actually neither Debugger nor IDE are involved.
They are not responsible for starting php sessions and would never be.
Please check you php configuration, in particular session.auto_start and session.save_path settings.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 15 Dec 2005
Posts: 3
Reply with quote
On the windows platform the session.auto_start is set to 1 and session.save_path= / . these are the same settings for when I run it through the IDE as well as when I call it directly. I have added a way to run phpinfo() form my application to make sure things are set up as expected.

The thing is that everything works if just using the browser or pre-loading the start page before debugging. The problem with the sessions only exists if debugging from within the IDE.
View user's profileFind all posts by tmoseSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Just to make it clear.
In no way phped's debugger affects PHP sessions.
If you get a problem with sessions under Windows, check the settings.
If you get problem only while working in the IDE, check php.ini settings of the php that the IDE works with. Check phpinfo results while you're in the IDE.
Again IDE itself has no way to affect php sessions. It must be something wrong with php.ini. Start checking with "path to php.ini" you see in phpinfo() output produced while you're in the IDE. Make sure you're editing php.ini listed in phpinfo. Check other session-related stuff. Having root directory as storage for session files is wrong idea. When installs PHPED configures its own path to the sessions, by default c:\program files\nusphere\phped\php\sessions. Is there any reason for changing this setting? Also make sure that session.save_handler is still 'files'... etc.
If you want us to help you, please submit phpinfo() output, php.ini and script to replicate the problem.
View user's profileFind all posts by dmitriSend private messageVisit poster's website
RE: Proplems with PHP sessions


Joined: 15 Apr 2009
Posts: 1
Reply with quote
tmose,

I had a similar problem in that the internal browser kept it's session data even after I closed the output tab (at which point I considered the session 'closed'). Anyway I would rerun the page and the data would still be there. The following code took care of my problem and it may help you avoid external browsers or shutting down the IDE just to clear your session data if your problem is similar:

// logout.php

Code:
session_start();
unset($_SESSION[username]); // remove any session data you want gone.
unset($_SESSION[userid]);


All the best
View user's profileFind all posts by trentSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
Quote:
I had a similar problem in that the internal browser kept it's session data even after I closed the output tab (at which point I considered the session 'closed')


no, session won't be closed with closing the tab.
Indeed, all kind of sessions for the web applications are based on cookies. In most cases, session cookies are temporary and therefore they belong to the process. If you open a browser, start a session, then open new window with Ctrl+N, session will be in-effect for the 2nd browser window too because it runs in the same process. Now if you close original window, nothing will change for the 2nd window because the process keeps going.
Same goes to the IDE. Even if you close Output window, the process (the IDE) is still running and therefore temporary cookies are not dropped. You need another way by which you'll destroy the session (for example logout link on the page) or use external browser.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Proplems with PHP sessions
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic