Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to kill a PHP session?
    primarykey
    data
    text
    <p>This general topic has come up before, <a href="https://stackoverflow.com/questions/252907/why-does-session-start-cause-a-timeout-when-one-script-calls-another-script-using">here</a>, <a href="https://stackoverflow.com/questions/4333209/session-start-hangs">here</a>, <a href="https://stackoverflow.com/questions/2902595/i-call-session-start-the-script-hangs-and-nothing-happens">here</a>, and no doubt elsewhere on the internet as well. In my case, unlike these, the hang arises from a blocking socket that never gets a message, and perhaps that's why the solutions described there haven't worked for me. I'm developing in tandem a C++ app which communicates with the php script via a local socket connection, and when the C++ app crashes, it leaves the php script's socket waiting for a message that never comes. I've tried using session_destroy and session_unset (calling these first in a script before session_start) but they don't work; even quitting and restarting the browser doesn't help. I can only stop the session if I remove the session_start, reload the script and then end the session via the client. How can I kill the session without having to go through that?</p> <p>Edit: I forget to mention, I also tried to time the socket out with</p> <pre><code>socket_set_option($socket,0, SO_RCVTIMEO, array("sec"=&gt;1, "usec"=&gt;0)); </code></pre> <p>But I got an 'invalid operation' error, and it didn't work.</p> <p>Edit 2: Setting a manual timeout, following the tip <a href="https://stackoverflow.com/questions/389645/php-how-to-set-a-timeout-on-socket-read">here</a>, worked well enough. I still don't know how to, in general, kill a session that's e.g. stuck in an infinite loop, but oh well.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload