I am checking if the cookie exists or not. Code run perfect on localhost but not working on server.
if(!isset($_COOKIE['checkuser']))
{
// Create a cookie
}
else
{
// do other other action
}
page is not being load on if accessing from webserver. but on localhost its work fine. is there is some setting that I need to do for this ?
If your error is “the page is not loading” then it is almost certainly not related to the code you posted. You mention in a comment that you’re doing some database calls in code you didn’t post – that’s far more likely to cause trouble than an
isset()call.What error are you seeing? If you are seeing just a blank page, that’s likely a syntax error which is being logged to the server’s error log rather than to the screen, for security purposes. Check your server’s error logs for an associated message.
It’s likely your server is running either a different version of PHP or a different security level (PHP safe mode, for instance) which is causing it to fail on the server but not on your machine. Alternatively, it may be failing to connect to the server’s database.
Please update your question with more information (more code and/or the exact error message would be a good start) if this isn’t enough information to solve your problem.