Prestashop Admin Page Keep Getting Log Out

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)) 

Source: vodien.com

Get 500 Internal Server Error from Prestashop

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.

Problem resolved.

Prestashop: Generate and Change Cookie Key

According just random generate of character 56 and 8. The cookie key within settings.inc.php

array(‘_COOKIE_KEY_’, Tools::passwdGen(56)),
array(‘_COOKIE_IV_’, Tools::passwdGen(8)),

If you want to change your Cookie Key, you should have problem enter the admin page. Here the recovery method:

  1. Copy your cookie key from /config/settings.inc.php, for example :
    zhNXco9AkmOMkXSA1UJvRLT0oy1K0bImRwhAjXHdIVexfO18ZyFzwsLL
  2. Go to http://www.md5.fr/
  3. In the field, paste the cookie key and type IMMEDIATELY after, without space, your password, for example :
    zhNXco9AkmOMkXSA1UJvRLT0oy1K0bImRwhAjXHdIVexfO18ZyFzwsLLadminshop
  4. Generate the MD5 hash.
  5. Copy it.
  6. Paste it in the passwd field of the ps_employee table, for your admin user.

source: http://www.prestashop.com/forums/viewthread/22045/