Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View php session variables

Not sure if this belongs here or at webapps... please move if appropriate.

I don't even know if such a thing is possible, but is there an extension or add-on for either Firefox or Chrome that would let me view all my PHP session variables the way there are extensions that let you view cookies?

like image 342
EmmyS Avatar asked Mar 21 '11 20:03

EmmyS


People also ask

How can I see session variables in PHP?

You can check whether a variable has been set in a user's session using the function isset(), as you would a normal variable. Because the $_SESSION superglobal is only initialised once session_start() has been called, you need to call session_start() before using isset() on a session variable.

How can I see session variables in browser?

# View sessionStorage keys and valuesClick the Application tab to open the Application panel. Expand the Session Storage menu. Click a domain to view its key-value pairs. Click a row of the table to view the value in the viewer below the table.

Can you edit session variables?

Session variables on the client are read-only. They cannot be modified.

How can I get all sessions in PHP?

php session_start(); echo "<h3> PHP List All Session Variables</h3>"; foreach ($_SESSION as $key=>$val) echo $key." ".


2 Answers

Cookies are available on the client-side, so they can be seen from the browser.


On the other hand, session data is stored on the server, and never sent to the client (except you write some code to do just that, of course).

To dump the content of a variable, like $_SESSION, you can use the var_dump() function.
On a development server, you can install the Xdebug extension to enhance its output greatly (and lots of other debugging-related things, btw).

If you don't want to pollute the HTML of your page, you could install the FirePHP extension to FireBug, and use the corresponding PHP library to send data (like dump of variables) to it.
This would allow your variables, like $_SESSION, to be displayed in firebug's console.

like image 132
Pascal MARTIN Avatar answered Sep 19 '22 16:09

Pascal MARTIN


PHP session variables are stored on the server and are inaccessible to the client.

like image 34
Nick Avatar answered Sep 20 '22 16:09

Nick