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:


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

6 Replies to “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!

  2. 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 to XueMing Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.