UPDATE ON THE PROBLEM:
Just provide the 4th argument when calling setcookie function :
setcookie ("PHPSESSID", "", time() - 3600, '/');
Explanation
The 4th argument of the
setcookie()function is$pathof the session to be set. And for this, "The default value is the current directory that the cookie is being set in.". (See : http://php.net/manual/en/function.setcookie.php.) So if you are calling this function from a file locating in folder "/folder", it will try to delete a cookie from that folder only. By setting the$pathto "/" we are telling the function to delete the session_id from the root directory.
I have tested it and it deleted the PHPSESSID from the cookie successfully.