Ok, I am almost certain I am doing something wrong in my code, but for the life of me I cannot figure out what the heck is wrong. I am trying to set a cookie on my local development machine, which also happens to be utilizing mod_rewrite. I think I may be screwing the cookie path up somehow. This is how I am trying to set the cookie...
Code: Select all
<?php
setcookie('appname_data', serialize($session_data), time() + 31536000, '/', 'localhost', '');
?>
With mod_rewrite enabled, I have links like:
Code: Select all
http://localhost/AppName/
http://localhost/AppName/login/
http://localhost/AppName/logout/
http://localhost/AppName/landing/
I cannot get the cookie to set. I am not getting errors from the code. I did a boolean check on the return of setcookie and it shows that setcookie is returning boolean true, but they are not setting in browser. The browser is set to accept all cookies.
I really think this is a path issue, but I can't be certain. I have tried setting the cookie path to './', '/', '/AppName/', etc, but I cannot see my problem. Can someone throw down a fresh view on my stupidity do I can move on from here?