The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Try out my first PHP web app! Reply To: Try out my first PHP web app!


You should only be calling session_start once per script execution. If you’re calling it multiple times, each subsequent call is generating an error (if you don’t see these errors, then you have your error reporting configured wrong).

I’m sure I’ve asked you before, but I am absentminded and cannot bring myself to look through the two dozen pages of this discussion: what version of PHP are you running?

Since PHP 5.4, you can use session_status to check if a session has been started yet:

if( session_status() === PHP_SESSION_NONE ){ session_start(); }

Otherwise, you’ll need to check whether session_id returns an empty string.

Another solution would be to redesign your application with a “single point of entry,” so you have fuller control over the program flow. Not that I’m saying you have to do that at this point.