You can specify a default session name in your php.ini file. This is the default name a session is tagged with.
If you want to change this, open your php.ini file and search for the following text:
Once you found it, you (probably) will notice that this setting has a value: PHPSESSID. This is the default value that comes with PHP. You can change this with anything you want. Be careful, it should only contain alphabetic characters. If there are semicolons in front of it, like this:
you have to remove the semicolons like this:
Now save your file and restart your server.
However, this is not the only way to do it. You can call and or change the value with PHP like this
// Set new session name
session_name('ContactForm');
// Initialize session
session_start();
Please note that you have to add session_name on each of the pages you want to continue with your defined session_name.
Important: the function session_name() needs to be called before session_start();
You can call the current session name like this:
// Return session name session_name(); // Echo session_name echo session_name();
Mail this!
- Comments (0)
- PingBacks (0)
- TrackBacks (0)

» Latest comments