Posted February 28th, 2010 by bernard
I tri to write and read a cookie and it doesn't work.
I am with localhost in debug mode, Windows vista, apache 2.2.9, php 5.2.6, Visual Studio 2008, VS.php trial version
I tri with IE or Firefox
in the index.php :
<?php
session_start();
//test COOKIE
if(empty($_COOKIE['moncookie']))
{
setcookie("moncookie","cookie toto",time()+3600*24*365);
echo "pas de cookie";
echo "</BR><A HREF='index.php'>Read the cookie</A>";
}
else
{
$montest = $_COOKIE['moncookie'];
echo $montest;
}
?>It runs correctly in my standard configuration and in debug mode it never arrives to the else.
Can you help me ?
bernard says:
My question about the cookies is not interesting?
Perhaps that cookies do not work with VS.PHP?
Please answer my questions.
Bernard
juanc says:
The issue seems like, is that you are overriding all cookies. There is a debug cookie that must stay for everything to work fine.
bernard says:
I don't realy understand your answer. What do you mean about overriding all cookies ?
The debug cookies are in the same place than standard cookies in C:\Users\Bernard\AppData\Roaming\Microsoft\Windows\Cookies or in other directory ? What is the name of file where are the cookies in debug mode ? With that I can check if it is a writing or reeding problem.
juanc says:
Try check the value of all cookies before and after you call setcookie.
XDebug requires a cookie to function properly.
bernard says:
How can I check all cookies ?
How can I set cookies in Xdebug ?
juanc says:
use $_COOKIES