473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

where does php place cookies?

Hello all,

This is baffling me. I am starting a session and I know it is setting a
cookie on my computer - I called getallheaders() and see that it is
setting the cookie, and it is also accessible in $_COOKIE. I cleared
all cookies in my Cookies folder before starting the session, and
everytime I run the script it does not create a cookie in the folder.
For testing I even set the browser to accept all cookies to make sure.

session.use_cookies is on in php.ini, session.use_only_cookies is off,
and session.use_trans_sid is off. The session data file is definitely
being created, but I cannot find the corresponding cookie no matter what
I try.

Thanks in advance for all your help.
Oct 4 '05 #1
6 2102
On Tue, 04 Oct 2005 04:11:07 GMT, Marcus <Ju********@aol.com> wrote:
This is baffling me. I am starting a session and I know it is setting a
cookie on my computer - I called getallheaders() and see that it is
setting the cookie, and it is also accessible in $_COOKIE.


PHP sessions use so-called "session cookies" -- they are not
perminently stored and disappear when you close your browser. Thus
they are never written to you cookies folder.

Oct 4 '05 #2
Wayne wrote:
On Tue, 04 Oct 2005 04:11:07 GMT, Marcus <Ju********@aol.com> wrote:

This is baffling me. I am starting a session and I know it is setting a
cookie on my computer - I called getallheaders() and see that it is
setting the cookie, and it is also accessible in $_COOKIE.

PHP sessions use so-called "session cookies" -- they are not
perminently stored and disappear when you close your browser. Thus
they are never written to you cookies folder.


That explains a lot. :-) Thanks Wayne.

Are they put in any other directory, or do they just reside in the
server's RAM or some other temporary storage device?
Oct 4 '05 #3
Marcus wrote:
Wayne wrote: [snip]
That explains a lot. :-) Thanks Wayne.

Are they put in any other directory, or do they just reside in the
server's RAM or some other temporary storage device?


They reside in *your computer's RAM* allocated by the browser, not on
the server side. They are never written to disk (until you are short of
free RAM - then you can maybe find them in your swapfile/swap partition :))

Y.
Oct 4 '05 #4
On Tue, 04 Oct 2005 06:13:34 GMT, Marcus <Ju********@aol.com> wrote:
Are they put in any other directory, or do they just reside in the
server's RAM or some other temporary storage device?


I assume you mean client's RAM not server's RAM -- and yes, that is
where they reside.

Oct 4 '05 #5
Wayne wrote:
On Tue, 04 Oct 2005 06:13:34 GMT, Marcus <Ju********@aol.com> wrote:

Are they put in any other directory, or do they just reside in the
server's RAM or some other temporary storage device?

I assume you mean client's RAM not server's RAM -- and yes, that is
where they reside.


Yes, I'm sorry, I spent 10 hours straight coding and researching stuff,
and my brain was fried at 1 am. :-)

If it does reside in RAM, how can you set it to have a lifetime of
years? Once the user turns the computer off, doesn't this flush the
system memory and thus kill any cookie settings that were set?
Oct 4 '05 #6
>If it does reside in RAM, how can you set it to have a lifetime of
years? Once the user turns the computer off, doesn't this flush the
system memory and thus kill any cookie settings that were set?


Look at the PHP documentation for setcookie(). A session-only
cookie (one created by calling setcookie with an expire time of 0)
will expire when the browser is closed. It doesn't have an expire
time, and might manage to last more than 2 years if the browser
stays open that long. It's not stored on disk, at least in most
browsers.

A non-session-only cookie will have an expire time, often given to
setcookie() as time() + a number of seconds to last. These cookies
will be stored on disk somewhere. Where depends on the browser,
but it's likely to be in a similar place to where the browser
configuration parameters are stored.

Gordon L. Burditt
Oct 4 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mark4asp | last post by:
Hello, I'm running my script locally and the cookie has been saved on the machine because the login page is by-passed (with the Redirect to "menu.asp" below. OK - but where is my cookie...
3
by: HorseGeek | last post by:
I can't find a cookie that my code is writing. The behavior of my webpages indicates that the cookie IS being written SOMEPLACE. However, I can't find it. My client does not want the code going...
2
by: Harry Haller | last post by:
Why does the following work: // (1) Set new cookies setcookie ("font_type", $type_sel, time()+3600); setcookie ("font_size", $size_sel, time()+3600); // (1) Get most recent cookie $font_type =...
1
by: Jason Shohet | last post by:
I need to get the computer name that the user's browser is on (intranet app here). We don't want Netbios turned on. So, when the user logs in, the network engineers have a file written onto the...
7
by: DC Gringo | last post by:
I was under the impression that when I create session variables such as session("myVar1"), they get stored on the client in a cookie. When I look in my Temporary Internet Files directory for the...
3
by: mosesdinakaran | last post by:
Hi Where does the cookies stored in the client machine that php creates after calling session_start() function. I am using IE... I checked in the following folders but no cookies are stored....
2
by: Eric | last post by:
Hello, I'm trying to debug a problem that some users of our ASP app see that goes away when they clear their cookies. I've gotten a copy of their cookie for our app and have renamed it from...
2
by: StanB | last post by:
I came across this weird problem: 1. Session state stops working after the app is deployed to another server because IE does not accept cookies. 2. It works if cookieless="true" in the...
7
by: cmrchs | last post by:
Hi, In Windows Vista: where does asp.net write its cookies? I use HttpCookie objCookie = new HttpCookie("nameCookie"); in Win2000 (and later) they used to be in C:\Documents and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.