News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Brian Swan's Blog:
Using SQL Azure to Store PHP Session Data
October 21, 2011 @ 08:32:46

In a recent post to his blog Brian Swan takes a look at working with sessions in PHP and, specifically, how to save them to Azure along with all of their data.

In my last post, I looked at the session handling functionality that is built into the Windows Azure SDK for PHP, which uses Azure Tables or Azure Blobs for storing session data. As I wrote that post, I wondered how easy it would be to use SQL Azure to store session data, especially since using a database to store session data is a common and familiar practice when building distributed PHP applications. As I found out, using SQL Azure to store session data was relatively easy (as I'll show in this post), but I did run into a couple of small hurdles that might be worth taking note of.

He uses PHP's own session_set_save_handler to point to his custom Azure handling class with the needed methods (like write, close and destroy). He breaks it out into three simple steps, some with a bit of code attached:

  • Create the database, table, and stored procedure
  • Add the SqlAzureSessionHandler class to your project
  • Instantiate SqlAzureSessionHandler before calling session functions as you normally would

The code for the Azure handling class can be downloaded here.

0 comments voice your opinion now!
sql azure session data cache sqlserver windows


blog comments powered by Disqus

Similar Posts

Metapundit.net: Code Smells II

Ilia Alshanetsky's Blog: PHP 5.2.0 RC3 Released!

Geeks Not Nerds Blog: Rolling your own Blog Backend from Scratch Part 1

SecurityFocus.com: Five common Web application vulnerabilities

Unravel the Music Blog: Partial-page caching with Memcached and PHP in 3 easy steps


Community Events





Don't see your event here?
Let us know!


unittest introduction bugfix podcast symfony package series release framework library language opinion deployment laravel zendserver api interview community install voicesoftheelephpant

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework