Checking if session support is enabled on the server

Hi,

In my script, I want to check if session support is enabled on the server the script is installed on. I think I can use session_status() but it requires PHP 5.4+ so, I am looking for something that will also work on previous PHP versions.

As an option, I have the following code:

if (!is_callable('session_start')) {
  // session support disabled...
}

Is this a good way to do this check? Any better way you can think of?

Thanks.

session_start should always be callable.
As of PHP 5.3, session_start returns a boolean FALSE if it was unable to start a session, so you can just if(!session_start())

Thanks for the reply. So, you mean session_start() is callable even if session support is disabled by php.ini etc.? Then I will use just the check you suggested.