title: Best alternative to set a PostgreSQL schema using PHP PDO
body: <p>I am using PHP PDO to access a PostgreSQL database with various schemas, so first i create a connection and then i set the correct schema, like below:</p>
  
  <pre><code>$Conn = new PDO('pgsql:host=localhost;port=5432;dbname=db', 'user', 'pass');
  
  $result = $Conn-&gt;exec('SET search_path TO accountschema');
  
  if ( ! $result) {
      die('Failed to set schema: ' . $Conn-&gt;errorMsg());
  }
  </code></pre>
  
  <p>Is this a good practice? Is there a better way to do this?</p>