A PHP session solves this problem by allowing you to store user information on the server for later use (i.e. username, shopping cart items, etc). However, this session information is temporary and is usually deleted very quickly after the user has left the website that uses sessions.
It is important to ponder if the sessions’ temporary storage is applicable to your website. If you require a more permanent storage you will need to find another solution, like a MySQL database.
<?php
session_start(); // start up your PHP session!
?>
<?php
session_start();
session_destroy(); //stop/cleaned your PHP session !
?>
Sessions work by creating a unique identification(UID) number for each visitor and storing variables based on this ID. This helps to prevent two users’ data from getting confused with one another when visiting the same webpage.
PHP conditions to storage session in PHP 4+ for Windows users must change a directory storage from /tmp to another directory according your files stucture. Eg :C:temp” or if you are using XAMPP for Windows, please read carefully in PHP.ini file and find “session.save_path” and change to “C:xampptmp” ,this directory all files sessions are stored. and re-checked your “Register_Global” in PHP.ini instead Off, but if require Turn On.
I hope this information helpful.
- Follow us on Twitter, or subscribe to the rizqtech RSS Feed for more daily web development and articles.
Enjoy this Post!

