Notes on PHP: Restart apache won’t reset php session

 

To be honest, it is a little odd that PHP session won’t be destroyed after Apache server got restarted. In order to truly kill the PHP session, especially during development, I created a piece of following code, and ran it everything I wanted to have a clean start:


<?php

session_start();
unset($_SESSION['session_name']);
session_destroy();

?>

 

Advertisements

3 thoughts on “Notes on PHP: Restart apache won’t reset php session

  1. So, do you think it’s odd? Imagine having a website with a few hundred customers with products in their shopping cart, and for some reason, you need to quickly restart the Apache server because you made a modification in the configuration file. Would you want all of your customer losing their sessions? Would you like it to happen to you? Losing all of your items in your shopping cart after a long time of search, investigation, comparison etc.. ?? It would get you very frustrated I’m sure.

    Cheers man!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s