Menu

cookie.php

Christian Boltz

PostfixAdmin uses a session cookie when you login.

If you have login problems (for example, you can't login, but don't see an error message about wrong username/password), please test if cookies work as expected.

Please save the following code as cookie.php in the PostfixAdmin directory:

<?php
session_start();
echo session_id() . "<pre>";
var_dump($_SESSION);
$_SESSION['foo'] = 'works';
echo "\n\nCookies:\n";
var_dump($_COOKIE);
?>

Then open cookie.php in your browser - the first time, it should print the session ID and a list of your cookies. Reload it, and it should display the same session ID and additionally "works" as session content.

Typical problems:

  • if you get a different session ID:
    • your browser might not accept cookies
    • check session.cookie_path in php.ini - if in doubt, set it to /
    • check if a proxy or cache (for example varnish) drops the session cookie
  • if you get the same session ID, but don't get "works" displayed, PHP probably has a problem with storing the session data.
    • check session.save_path in php.ini
      • that directory must exist and be writeable for the webserver (typically user www or wwwrun)
      • that directory should contain a file named like the session ID
      • the session file should contain "foo" and "works" (if you use suhosin-encrypted sessions, at least check the filesize)

Also check if you override one of the mentioned php.ini settings somewhere (if in doubt, check with phpinfo()).