View php session variables

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


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.


No. Session data is server-side, while cookies are client-side. The session cookie contains the session identifier, which the server (i.e.: PHP) uses to retrieve the proper session data.

It is not possible to view session data without remote access to the server, or using a script (that resides on the server).

This is why it is recommended to store "sensitive" information in session instead of cookies, because it cannot be consulted/altered easily.