Home arrow PHP arrow Introduction to Maintaining the State of Applications with PHP Sessions

Introduction to Maintaining the State of Applications with PHP Sessions

In PHP, session management is used to help web applications maintain their state across several HTTP requests when needed. In this first part of a series, you will learn the basics of the PHP built-in session mechanism, as well as some of its many useful functions.

TABLE OF CONTENTS:
  1. Introduction to Maintaining the State of Applications with PHP Sessions
  2. Working with persistent data: the basics of session management
  3. Ending a session: using the “session_destroy()” function
  4. More session functions ahead: finding out the name of active sessions
  5. Configuring the PHP session module: using some helpful session functions
By: Alejandro Gervasio
Rating: starstarstarstarstar / 18
April 26, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Due to the fast evolution of Web programming, the stateless nature of the HTTP protocol brought many problems to certain Web applications that required maintaining their state across several HTTP requests. This demanded a rapid development of several mechanisms aimed at tackling this issue through diverse methods.

Particularly, in the universe of PHP programming, session management emerged as a direct response to the above mentioned problem, and currently this mechanism is being used by PHP developers worldwide, in cases where a Web application needs to keep track of its “state” during the occurrence of different HTTP requests.

Whether you’re a beginner developer or an experienced PHP programmer, it’s quite probable you’ve already used some of the built-in functions included within the PHP session management module, when constructing user authentication systems, shopping carts or web-based email applications, to name a few illustrative cases.

Indeed, PHP sessions are very simple to use. They hide all the complexities inherent to where and how to store session data, and provide developers with a transparent mechanism for managing information that must persist or keep state even if different HTTP requests are triggered across the same Web application.

Since PHP sessions are one of those things that sooner or later you must learn as a PHP developer, in this article I shall provide an overview of them. I will begin with the basics of how to use them, highlighting their strong points and weaknesses, and finally explore some of their most advanced concepts. By the end of this series, you should have all the knowledge that you need to start using the most common PHP session management functions, so you can use them during the development of your own applications.

With the preliminaries out of the way, it’s time to move on and start out exploring the features of the session management mechanism in PHP. Let’s get going!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap

Dev Shed Tutorial Topics: