On recent development on Prestashop, I was getting the issue of keep getting log out at the admin page. It was like after few clicks after login, I was logout and request to login again.
After searching, here the solution on how to resolve it. From my experience, it only appears at my ISP Starhub. 😦
Code in classes/Cookie.php
if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd) AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr())))
Modify it to
if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd))
After transferred Prestashop from one location to another, but unfortunately getting the 500 Internal Server Error?
Just share some tips how I debug it.
A very wise method is go to Apache logs folder to check those error log. For my case it is at /var/log/apache2/. Check the error_log file and immediately, the latest log shows that it has serious issue writing at my prestashop tools/smarty/compile folder.
PHP Fatal error: Smarty error: unable to write to $compile_dir ‘xxx/xxx/tools/smarty/compile’. Be sure $compile_dir is writable by the web server user. in xxx/xxxx/tools/smart/Smarty.class.php on line 1095
So obviously the permission issue, so change it to 777 and immediately it is working again.
According just random generate of character 56 and 8. The cookie key within settings.inc.php
If you want to change your Cookie Key, you should have problem enter the admin page. Here the recovery method:
- Copy your cookie key from /config/settings.inc.php, for example :
- Go to http://www.md5.fr/
- In the field, paste the cookie key and type IMMEDIATELY after, without space, your password, for example :
- Generate the MD5 hash.
- Copy it.
- Paste it in the passwd field of the ps_employee table, for your admin user.