<p>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.</p>

<p>PHP automatically sets the cookie where available. I learned it is possible to change this behaviour by setting <code>session.use_cookies</code> to 0 in <code>php.ini</code>. 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.</p>

<p>Is there a way to disable or void the session cookie inside the PHP script?</p>

<p><strong>EDIT:</strong> 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.</p>

Use
ini_set()
:
```
```
ini_set('session.use_cookies', '0');
```
```
Or in your php.ini file:
```
```
session.use_cookies = 0
```
```