answersLogoWhite

0

The session is stored on the web server. The cookies is stored in a little file on users machine. This means that the session is (relatively) secure, whereas the cookie can be edited by the end user.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Difference between apache and PHP?

Apache is a web server. PHP is a scripting language.


How do you maintain a session across servers in PHP?

There's no "right" answer to this question (as with anything programming-related) but it should point you in the right direction. Session support in PHP is accomplished through cookies by default (all of this can be overridden via code). Since you're unlikely to want to travel outside of cookies for your solution, you're restricted to whatever cookies will allow you to do (as with any language). PHP stores a session-id in a cookie and on the filesystem by default. This means the cookie needs to be set so that your browser sends it to each server during a request, and that each server has access to the server-side store which holds the session data for each cookie. If all servers share the same DNS name (service.domain.local) your browser will send it regardless, but if they do not (intranet.domain.local and applications.domain.local) you will need to use the session_set_cookie_params() function to set the domain to a common subdomain - i.e. ".domain.local". Be aware that this sends it to every web server matching ".domain.local" so other machines will receive your highly important session-id, so plan this out carefully. Once the web servers are all receiving the cookie, your PHP installation will need access to a common storage location. By default, PHP stores cookies in a local directory with the filename being the session-id and the contents being the session data. Thus, you'd need to access/share the same directory on all machines or change that behavior. I'd suggest investigating the many ways you can move session storage to a database so all machines have reliable, safe access to the session store - and, you can report on those sessions down the road. In short, it's a two-pronged approach: set the session cookie up so it reaches all of your servers (again not an issue if they all have the same hostname) and configure PHP to pull session data from one central place.


Write down a PHP code to add a session variable?

The preferred way is to simply alter the session superglobal. <?php $_SESSION['variable'] = "value"; ?>


What is the purpose of a PHP session?

A PHP session serves quite a few purposes. PHP sessions store data that the web application developer would like to have preserved across the different page loads.


What is a php session?

A PHP session is a concept where specific variables (and their respective values) are carried throughout a user's viewing of a PHP-driven website. These sessions can be initialized and continued using the session_start() function. The session values are stored in the $_SESSION global variable. For more information, see the php.net documentation of session functions.


What is the difference between POST and REQUEST methods in PHP?

The $_POST array contains only variables supplied by a form that used the POST method, while the $_REQUEST array combines the $_POST, $_GET and $COOKIE arrays.


What is the difference between PHP and struts?

STRUTs is a framework of technology of java based on JSP/Java Servlets PHP is another server scripting language


How can you get the session after the user logs out in PHP?

Depends what you mean with that. If the user logs out, the session gets destroyed, and with it the session ID. You'd need to grab the session ID before the user logs out.


What is the difference between net and php?

.net is a framework based on Microsoft software and is not open source, php is a language which is open source and based on Linux/unix systems


Difference between jsp and php?

JSP stands for Java Server Pages whereas PHP stands for Hypertext PreProcessor. PHP is a scripting language whereas JSP is a full fledged technology. JSP is much more powerful and has more features than PHP


What is the difference between the 1982 Large Digit and Small Digit pennies?

http://www.thecentproject.com/sort1982.php


How do you update and delete data from PHP sessions?

To update/delete data from a session all you need to do is the following: <?php // to update the session, you just overwrite it like a normal variable $_SESSION['name'] = "pizza"; // to delete a sessions data you can do this $_SESSION['name'] = ""; ?>