title: PDO : Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'
body: <p>I uncommented the lines <code>extension=php_pdo_mysql.dll 
  extension=php_pdo.dll</code> in my php.ini file but I still got the error
  <code>Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'</code> 
  None of the previous answers worked for me what should I do ? </p>
  
  <pre><code> $options = array(PDO::MYSQL_ATTR_INIT_COMMAND =&gt; 'SET NAMES utf8'); 
  try 
  { $cnx = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password,$options); 
  } 
  catch(PDOException $ex) 
  {  die("Failed to connect to the database: " . $ex-&gt;getMessage()); 
  } 
  </code></pre>