Q:

connection_aborted not working in php, apache2

So I am creating a user login, logout system. Whenever the user wants to login, it creates a row in a Sessions table. Then if the user wants to logout, it sets an integer to one in that session. But, if the user closes the browser I cannot detect that. I am using connection_aborted to do that, however it is not working.
I set the output_buffering to Off in the php.ini, but I do not know what is happening!
if (connection_aborted()) {
        mkdir("connection_aborted", 0777);
    }

A:

connection_aborted() just checks whether the client/server connection (typically the tcp/ip connection) has been aborted, not whether the browser window has been closed.
To detect ending the session you need a solution in javascript like the one presented e.g. in the the blog post jQuery & Javascript – Capture the Browser or Tab Closed Event

