PDO not throwing exception on wrong SQL query
<p>I am pretty much familiar with MySQLi and was trying PDO, I heard it is better. I was going through the tutorial present <a href="http://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059">here</a>. They say that PDO throws an exception when PDO::ERRMODE_EXCEPTION is set and we accidentally do something wrong with the query (for example, typing it incorrectly, DELECT instead of SELECT). I typed in the same wrong query to see the error and exception message on my local environment. I have latest WAMP installed with PHP 5.5, MySQL 5.6 and Apache 2.4.9 in my 32-bit Windows 7 PC, but did not get what I was expecting, no exception was thrown there. I tried the same code posted in the tutorial:</p>

<pre><code>try {
$DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$DBH-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

# UH-OH! Typed DELECT instead of SELECT!
$DBH-&gt;prepare('DELECT name FROM people');
}
 catch(PDOException $e) {
 echo "I'm sorry, Dave. I'm afraid I can't do that.";
 file_put_contents('PDOErrors.txt', $e-&gt;getMessage(), FILE_APPEND);
}
</code></pre>

<p>No PDOError.txt, no error message. Is something wrong with the tutorial or my environment? Or there are cases where PDO fails to throw exceptions? I have PDO driver installed for MySQL.</p>