is your browser accepting the cookie? check your cookies.
also, on that day it stopped working, did you install any new security software on your computer?
| SitePoint Sponsor |
is your browser accepting the cookie? check your cookies.
also, on that day it stopped working, did you install any new security software on your computer?


Any idea?
Same problem here, and oddly enough, same output from those last 2 scripts. Worrying thing though is this:
Which effectively deletes the cookie as soon as it's made. Thing is though, I'm running these scripts locally btw, that cookies work for any other sites except localhost or 127.0.0.1. It's not Zonealarm or any security software I can see, so perhaps it's the router I go through to the internet, stripping out the headers.Code:Expires: Thu, 19 Nov 1981 08:52:00 GMT


I also use zone alarm, and it is not the security settings
aaron118, do you not know how to check your browsers cookies? you have ignored my question twice, i cant help you if i need to repeat myself over and over.


The only cookies that look to be set from localhost are for phpmyadmin
when you request a page locally, do you use
http://localhost/script.php ?


Sorry I honestly missed your question before. For the script im working on I request it like http://localhost/customers/script.php
Thanks again clamcrusher





In your php.ini configuration, there is a "session.cookie_domain" variable. Maybe try setting that to localhost? and "session.cookie_lifetime" set to 0 (which it SHOULD default to.. but at this point I'd like to not assume).


Ok I tried setting "session.cookie_domain" to localhost, didn't work. "session.cookie_lifetime" is already set to 0.
they have the proper values, you can see the cookie in the headers list i had him post. its a typical session cookie, just the name/value pair, and the path set to /, no expires time
i dont think you want to set the cookie domain to localhost. a blank domain means the current domain.
im really starting to get stumped here, and really thinking something is stripping the cookie out before it reaches the browser. im not sure why phpmyadmin successfully set a cookie though. only difference is that phpmyadmin uses an expires time. but you should not have to use an expires to be able to set a cookie, an empty expires time is part of the spec and has defined behavior.
just out of curiosity though...
try this
does it increment now when you refresh the page?PHP Code:<?php
ini_set('session.cookie_lifetime', 86400);
session_start();
echo '<pre>';
print_r(apache_response_headers());
echo ++$_SESSION['i'];
?>
edit- make sure you restore your php.ini to not have a cookie domain if you changed it.


No still no increasement, just a new session ID
i want to see if the cookie is actually reaching your browser.
download this extension for firefox(your going to love this extension btw)
https://addons.mozilla.org/firefox/60/
install it then in your new toolbar goto information>view response headers to view the headers of the page your currently looking at. post the results here.


Which file should I try to view the response headers with. Anyway I have tried it with the one you have just told me to try and I get this:
Code:Date: Wed, 21 Jun 2006 19:17:12 GMT Server: Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4 X-Powered-By: PHP/5.1.4 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html Transfer-Encoding: chunked 200 OK
yeah if you pointed it at the file with the code i just posted, something is stripping your cookies out.
try disabling zone alarm or any other software that might be security related.


I am an idiot, it was zonealarm all along. I did try disabling it before though, I must have not disabled it properly. It only works if I shut down zone alarm security suite completely. I have tried turning off sookie control in zonealarm but it is still blocking it. I don't know how to set zone alarm to allow my cookie?
Thanks


If I use 127.0.0.1 instead of localhost and if I add 127.0.0.1 as an allowed site to accept cookies it will work. But I never have a problem using other sites where cookies are allowed, so why is my script causing a problem with zone alarm?
Thanks
i have no idea why zone alarm behaves like that, but im glad we figured out the problem![]()


Is it something wrong with my script though. Becasue as I said I have never had a problem with any other sites allowing cookies?
zone alarm probably thinks its dangerous for some reason, something to do with the fact is was sent by localhost.
that cookie valid(and probably the most common type of cookie by far!). this is a zone alarm issue, not your script. maybe it is a bug in zone alarm, maybe it is a security feature, i dont know. maybe zone alarm could tell you why it does that.





Hi,
I know we looked at using cookies for session information, but I'd like to try something. Comment out all the session cookie related settings in php.ini so we're dealing with standard session handling. Then right before you do your header call, call session_write_close like so:
I think I may know why it's not working.PHP Code:session_write_close();
header("Location: blah");
exit;


When you say comment out all the session cookie related settings, do you mean the settings which have session.cookie in their name? Or to comment out every setting with "session" in it. I tried with commenting out every setting with "session" in its name and and called session_write_close(); but I still couldn't log in.
Not sure if you read above but, its zonealarm which is causing a problem with cookies on localhost. If I turn off cookie control it works on localhost.
Thanks
Hi guys,
i faced the same problem u've faced about zone alarm and session variables. i made it work without shutting down zone alarm completely. i turned off 'Cookie Control' and 'Ad Blocking' in the privacy section. it worked for me. try it, it may work for u and u dont need to shut down zone alarm.
Bookmarks