PHP Session Id changes between pages

According to PHP documentation, session_start must be called before any output is sent back to the browser-- could this page have a rogue CR/LF, Unicode byte-order mark or similar that is causing output before you include('session-inc.php')?


While migrating a legacy site from PHP4 to PHP5 I noticed a php.ini configuration setting that causes php to auto-start the session upon every request. It's an alternative to placing session_start() onto every page...

There are multiple ways to enable this setting:

Put the following line into php.ini:

session.auto_start = on

or put this into your apache virtual-site config or .htaccess file:

<IfModule mod_php5.c>
  php_flag session.auto_start on
</IfModule>

and it should make $_SESSION changes available across all pages

Tags:

Php

Session