title: Are prepared statements cached server-side across multiple page loads with PHP?
body: <p>I learnt about prepared statements when making a JDBC-enabled Java application, and my app uses a connection pooling layer that assures me that prepared statements are cached server-side and this gives a performance benefit.</p>
  
  <p>However, with PHP everything I've read says that they are only cached for the life of the page load. Generally I don't repeat the same query many times, but run several different queries, on a given page load, but will repeat them across multiple page loads.</p>
  
  <p>As my PHP processes are persistent (i.e. they will serve hundreds of pages in their lifetime instead of just one, using PHP-FPM), I was wondering if they will re-use database connections, rather than spawning and killing them off for each hit.</p>
  
  <ol>
  <li>Will using PHP-FPM with mysqli or PDO keep connections longer than a single page load?</li>
  <li>If it doesn't, can I make it?</li>
  <li>If it does, or I do #2, will this persist the caching of prepared statements longer than just one page load?</li>
  </ol>
  
  <p>Edit:</p>
  
  <p>Just to clarify, I'm not talking about the query cache, which is another beast entirely, or caching the output of queries. I want to cache the compiled prepared statement and its execution plan server-side.</p>