title: PHP - Tweak code containing session and redirect
body: <p>I am having a LAMP Server on my Raspberry Pi. I have a static page to control my home switches. Also, I have a button which load the following php code.</p>
  <p>PHP Code:</p>
  <pre><code>&lt;?php
     # Session Close
     session_start();
     unset($_SESSION['valid']);
     unset($_SESSION['timeout']);
     
     # Server Shutdown
     system('sudo /sbin/shutdown -h now');
     
     # Redirect Page
     header(&quot;refresh:0.1;url=https://www.google.com&quot;);
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
     &lt;head&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;!-- container --&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>The above code is doing: <code>close session</code>, <code>shutdown server</code> and <code>redirect to a page</code>.</p>
  <p>This code seems to work fine but with delay... It takes time to load page. Press button and waiting...</p>
  <p>I would like to ask if i can have the same result <code>but faster</code>. I need a tweak / speed up... Press button and instantly load redirect page and at the same time do the rest.</p>