I have developed a simple Cake application and after finishing coding of it, I uploaded it to my web server and now it has several problems (It works like a charm on localhost):
setFlashmessages doesn’t work (I’m using Sessions in database and there are records of some sessions incake_sessions)- After a successful login, it’ll redirect me to the login page again.
- Sometimes cache files just disappear! (My
tmpfolder is writeable)
Actually no actions is allowed before logging in but you should see a You are not authorized to access that location. flash message on top of login page but it just doesn’t appear however if you login with a bad username/password it’ll show a message(wth?)
Login and Logout methods of UsersController:
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
}
public function logout() {
$this->redirect($this->Auth->logout());
}
Last 100 queries executed (from logs):
SELECT `Session`.`id`, `Session`.`data`, `Session`.`expires` FROM `srv`.`cake_sessions` AS `Session` WHERE `id` = '7orjo8clp192qeie55k6pqro26' LIMIT 1
Sounds like sessions are broken on your webserver. Check your system clock – if it differs by more than a few minutes your sessions will expire very quickly, if not immediately