Activating Sessions


 session_start() 


Using session management always requires resources and, therefore, costs performance. Therefore, sessions have to be activated. Because cookies might be part of the package, this has to be done before any HTML content is sent to the client. This can be accomplished in two ways:

  • Activate sessions globally with the php.ini directive session.auto_start = 1.

  • Activate sessions on a per-script basis with the function session_start().

From a performance point-of-view, the latter option is the best one.

Activating Sessions (session_start.php)
 <?php   session_start();   echo 'Sessions activated.'; ?> 




PHP Phrasebook
PHP Phrasebook
ISBN: 0672328178
EAN: 2147483647
Year: 2005
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net