title: PHP Does not show errors when trying to connect to a wrong database using PDO
body: <p>I'm pretty much new to PHP and I'm having a very basic problem which I haven't found a solution to despite looking through similar questions in the forum.</p>
  
  <p>I'm trying to connect PHP with my database (MySQL) through PDO. If I enter a wrong username or password php does show an error in the browser but if I enter a wrong database name it doesn't retireve any errors. How is this possible? My code is as follows:</p>
  
  <pre><code>&lt;?php
  try{
      $conn = new PDO('mysql:127.0.0.1;dbname=myDb','root','root');
      $conn -&gt; setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  } catch(PDOexception $e){
      echo 'wrong credentials';
  }
  </code></pre>
  
  <p>My php.ini file is configured to show errors and Apache was restarted after modifying it with the following values:</p>
  
  <pre><code>error_reporting  =  E_ALL | E_STRICT
  display_errors = On
  display_startup_errors = On
  log_errors = On
  </code></pre>
  
  <p>I also tried to use the following code at the begining of my script but it still doesn't show errors related to a wrong database name</p>
  
  <pre><code>ini_set('display_errors', 1);
  error_reporting(~0);
  </code></pre>
  
  <p>Thanks a lot in advance for your help, I'm sure is probably a pretty stupid thing but I honestly can't figure it out.</p>