views:

44

answers:

3

Debugging a PHP program, is there any add-on/plug-in for browser which I can view sessions variables (those PHP $_SESSION["foobar"] )?

Best if I can change the value in the variables.

+1  A: 

There is no way to manipulate the values stored in sessions from the client side.

That's one of the main reasons you'd use a session over a cookie - YOU control the data. With cookies, the user can manipulate the data.

The only way to access/manipulate session data from the client side would be with an Ajax call or other JavaScript mechanism to call another php script, which would be doing the retrieval/manipulation of the session data via the session_ functions.

Jacob Relkin
A: 

Try XDebug

sasayins
+1  A: 

$_SESSION is server side variables. if we can read or change the value there are many things that we can do to hack or bad thing. however if there are phpinfo(); called we can read session variable but cannot change the value.

if we are developer for the app, we can debug all session variable with

print_r($_SESSION);

some usefull command

session_start(); // start session
session_destroy(); // unset all session variable

Session is an array so if you set $_SESSION['key']='value'; it is same like $array['key]='value;

apis17
Does PHP stored the $_SESSION variables in memory or(and) database?The background is, I have a PHP app to maintain. This branch version is a clone of the original one and aim to do some read-only stuff (mainly reporting). And, for this branch version, only a read-only access to the database server (which the main version is running) is given. There are quite some $_SESSION variables used. I need to debug them and (hopefully) keep the login/out functions working as the main app.
ohho
can debug with print_r($_SESSION)
apis17