I am writing PHP code where I want to pass the session id myself using POST. I don't want a cookie to store the session, as it should get lost when the user gets out of the POST cycle.
PHP automatically sets the cookie where available. I learned it is possible to change this behaviour by setting session.use_cookies
to 0 in php.ini
. Unfortunately, I don't have access to that file and I also wouldn't want to break the behaviour of other scripts running on the same server.
Is there a way to disable or void the session cookie inside the PHP script?
EDIT: As the proposed solutions don't work for me, I used $_SESSION = array() at positions in the code where I found the session should be invalidated.
Use ini_set():
ini_set('session.use_cookies', '0');
Or in your php.ini file:
session.use_cookies = 0
err its possible to override the default settings of your host by creating your own .htaccess file and here's a great tutorial if you havent touched that yet http://www.askapache.com/htaccess/apache-htaccess.html
or if you're too lazy to learn
just create a ".htaccess" file (yes that's the filename) on your sites directory and place the following code
SetEnv session.use_cookies='0';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With