title: Securing PDO connection strings for MySQL
body: <p>I'm just learning PDO and need to know if this connection (it works) is really secure. I put my connections in an inaccessible folder outside of the root.</p>
  
  <p>Is this well formed or can I improve it?</p>
  
  <p>Do I need the <code>$conn-&gt;setAttribute</code>...EXCEPTION?</p>
  
  <pre><code>$user = 'JoeUser';
  $pass = 'JoesPassword';
  
  try {
    $conn = new PDO("mysql:host=myWebHost.com;dbname=MydataBase", $user, $pass);
    $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  } 
  catch(PDOException $e) {
    echo 'ERROR: ' . $e-&gt;getMessage();
  }
  </code></pre>