PHP $_SESSION is empty

If you find that your global $_SESSION variable is empty there can be several reasons, here are a few:

  • The value of session.save_path is either invalid (does not exist) or the path is not writable (bad permissions).
  • The value of session.cookie_secure is true but you not using a secure site (SSL/https).
  • The value of session.cookie_domain is set to a domain that does not match your site. This is very common when cloning and setting up a dev or test environment from a production site with a public domain.