I copy my project to my desktop. But when i run the project on desktop it does not load login.php
.
session_start();
if (isset($_SESSION['username'])) {
header('Location: index.php');
}
I had the above code in my login page in order to redirect the user to index page if he is already logged in. This cause me the error. After deleting the above piece of code login.php
loaded successfully.
I am using xampp version compiled on 2013 on laptop and 2015 compiled version in desktop. Is this causing the error? and what is the solution for it.
You are getting this error because session variable is not set first try to print that like and you should use exit() after header. It should be always used with header to stop further processing.
session_start();
print_r($_SESSION['username']); // just to check session exist or not
If it does not solve your issue then provide all your code here.
I solved the issue. I changed my appache port number from 80 to 81 . I guess that was the error. i made a slight change in php.inc
file
session.use_only_cookies=0
has been changed to
session.use_only_cookies=1
Its working now
reference What may cause an ERR_CONNECTION_RESET error, on xampp while using session